~osomon/oxide/ensure-files-exist

« back to all changes in this revision

Viewing changes to qt/core/app/oxide_qt_content_main_delegate.cc

  • Committer: Olivier Tilloy
  • Date: 2014-09-25 16:27:09 UTC
  • mfrom: (677.1.95 oxide)
  • Revision ID: olivier.tilloy@canonical.com-20140925162709-h8bai0f1nfaf7cfy
Merge the latest changes from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <QtGui/qpa/qplatformnativeinterface.h>
22
22
 
23
23
#include "base/lazy_instance.h"
 
24
#include "base/logging.h"
24
25
 
25
26
#include "qt/core/browser/oxide_qt_content_browser_client.h"
26
27
#include "qt/core/gl/oxide_qt_shared_gl_context.h"
34
35
    LAZY_INSTANCE_INITIALIZER;
35
36
}
36
37
 
 
38
ContentMainDelegate::ContentMainDelegate(const base::FilePath& nss_db_path)
 
39
    : is_browser_(true)
 
40
#if defined(USE_NSS)
 
41
      , nss_db_path_(nss_db_path) {
 
42
#else
 
43
{
 
44
  DCHECK(nss_db_path.empty());
 
45
#endif
 
46
  QOpenGLContext* qcontext = WebContextAdapter::sharedGLContext();
 
47
  if (qcontext) {
 
48
    scoped_refptr<SharedGLContext> context(new SharedGLContext(qcontext));
 
49
    if (context->GetHandle()) {
 
50
      shared_gl_context_ = context;
 
51
    } else {
 
52
      DLOG(WARNING) << "Could not determine native handle for shared GL context";
 
53
    }
 
54
  }
 
55
}
 
56
 
37
57
oxide::SharedGLContext* ContentMainDelegate::GetSharedGLContext() const {
38
 
  return shared_gl_context_;
 
58
  return shared_gl_context_.get();
39
59
}
40
60
 
41
61
bool ContentMainDelegate::GetNativeDisplay(intptr_t* handle) const {
55
75
  return true;
56
76
}
57
77
 
 
78
#if defined(USE_NSS)
 
79
base::FilePath ContentMainDelegate::GetNSSDbPath() const {
 
80
  DCHECK(is_browser_);
 
81
  return nss_db_path_;
 
82
}
 
83
#endif
 
84
 
58
85
content::ContentBrowserClient*
59
86
ContentMainDelegate::CreateContentBrowserClient() {
60
87
  return g_content_browser_client.Pointer();
61
88
}
62
89
 
63
 
ContentMainDelegate::ContentMainDelegate(bool is_browser)
64
 
    : is_browser_(is_browser) {
65
 
  if (is_browser) {
66
 
    QOpenGLContext* qcontext = WebContextAdapter::sharedGLContext();
67
 
    if (qcontext) {
68
 
      scoped_refptr<SharedGLContext> context(new SharedGLContext(qcontext));
69
 
      if (context->GetHandle()) {
70
 
        shared_gl_context_ = context;
71
 
      } else {
72
 
        DLOG(WARNING) << "Could not determine native handle for shared GL context";
73
 
      }
74
 
    }
75
 
  }
76
 
}
 
90
ContentMainDelegate::ContentMainDelegate()
 
91
    : is_browser_(false) {}
77
92
 
78
93
ContentMainDelegate::~ContentMainDelegate() {}
79
94
 
80
95
// static
81
 
ContentMainDelegate* ContentMainDelegate::Create() {
82
 
  return new ContentMainDelegate(true);
 
96
ContentMainDelegate* ContentMainDelegate::CreateForBrowser(
 
97
    const base::FilePath& nss_db_path) {
 
98
  return new ContentMainDelegate(nss_db_path);
83
99
}
84
100
 
85
101
} // namespace qt