CEF3: Update to Chromium revision 130586.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@578 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
0b3ef6e2cd
commit
f94336aade
|
@ -17,5 +17,5 @@
|
|||
|
||||
{
|
||||
'chromium_url': 'http://src.chromium.org/svn/trunk/src',
|
||||
'chromium_revision': '128896',
|
||||
'chromium_revision': '130586',
|
||||
}
|
||||
|
|
|
@ -38,10 +38,13 @@
|
|||
#ifdef BUILDING_CEF_SHARED
|
||||
|
||||
// Use the existing CrAppProtocol definition.
|
||||
#include "base/message_pump_mac.h"
|
||||
#import "base/message_pump_mac.h"
|
||||
|
||||
// Use the existing CrAppControlProtocol definition.
|
||||
#include "base/mac/scoped_sending_event.h"
|
||||
#import "base/mac/scoped_sending_event.h"
|
||||
|
||||
// Use the existing UnderlayableSurface definition.
|
||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||
|
||||
// Use the existing empty protocol definitions.
|
||||
#import "base/mac/cocoa_protocols.h"
|
||||
|
@ -51,17 +54,23 @@
|
|||
#import <AppKit/AppKit.h>
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
// Copy of CrAppProtocol definition from base/message_pump_mac.h.
|
||||
// Copy of definition from base/message_pump_mac.h.
|
||||
@protocol CrAppProtocol
|
||||
// Must return true if -[NSApplication sendEvent:] is currently on the stack.
|
||||
- (BOOL)isHandlingSendEvent;
|
||||
@end
|
||||
|
||||
// Copy of CrAppControlProtocol definition from base/mac/scoped_sending_event.h.
|
||||
// Copy of definition from base/mac/scoped_sending_event.h.
|
||||
@protocol CrAppControlProtocol<CrAppProtocol>
|
||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
|
||||
@end
|
||||
|
||||
// Copy of definition from ui/base/cocoa/underlay_opengl_hosting_window.h.
|
||||
@protocol UnderlayableSurface
|
||||
- (void)underlaySurfaceAdded;
|
||||
- (void)underlaySurfaceRemoved;
|
||||
@end
|
||||
|
||||
// The Mac OS X 10.6 SDK introduced new protocols used for delegates. These
|
||||
// protocol defintions were not present in earlier releases of the Mac OS X
|
||||
// SDK. In order to support building against the new SDK, which requires
|
||||
|
@ -103,6 +112,11 @@ DEFINE_EMPTY_PROTOCOL(NSWindowDelegate)
|
|||
@protocol CefAppProtocol<CrAppControlProtocol>
|
||||
@end
|
||||
|
||||
// All CEF windows should implement this protocol to be informed explicitly
|
||||
// about underlay surfaces.
|
||||
@protocol CefUnderlayableSurface<UnderlayableSurface>
|
||||
@end
|
||||
|
||||
// Controls the state of |isHandlingSendEvent| in the event loop so that it is
|
||||
// reset properly.
|
||||
class CefScopedSendingEvent {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include <map>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/browser_main.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
@ -19,7 +18,7 @@
|
|||
#include "base/logging.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "content/browser/download/download_manager_impl.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/geolocation_permission_context.h"
|
||||
#include "content/public/browser/speech_recognition_preferences.h"
|
||||
|
@ -190,9 +189,9 @@ class CefSpeechRecognitionPreferences
|
|||
|
||||
} // namespace
|
||||
|
||||
CefBrowserContext::CefBrowserContext(
|
||||
CefBrowserMainParts* main_parts)
|
||||
: main_parts_(main_parts) {
|
||||
CefBrowserContext::CefBrowserContext() {
|
||||
InitWhileIOAllowed();
|
||||
|
||||
// Initialize the request context getter.
|
||||
url_request_getter_ = new CefURLRequestContextGetter(
|
||||
GetPath(),
|
||||
|
@ -207,10 +206,7 @@ CefBrowserContext::~CefBrowserContext() {
|
|||
}
|
||||
}
|
||||
|
||||
FilePath CefBrowserContext::GetPath() {
|
||||
if (!path_.empty())
|
||||
return path_;
|
||||
|
||||
void CefBrowserContext::InitWhileIOAllowed() {
|
||||
#if defined(OS_WIN)
|
||||
CHECK(PathService::Get(base::DIR_LOCAL_APP_DATA, &path_));
|
||||
path_ = path_.Append(std::wstring(L"cef_data"));
|
||||
|
@ -229,7 +225,9 @@ FilePath CefBrowserContext::GetPath() {
|
|||
|
||||
if (!file_util::PathExists(path_))
|
||||
file_util::CreateDirectory(path_);
|
||||
}
|
||||
|
||||
FilePath CefBrowserContext::GetPath() {
|
||||
return path_;
|
||||
}
|
||||
|
||||
|
@ -240,8 +238,8 @@ bool CefBrowserContext::IsOffTheRecord() const {
|
|||
content::DownloadManager* CefBrowserContext::GetDownloadManager() {
|
||||
if (!download_manager_.get()) {
|
||||
download_manager_delegate_ = new CefDownloadManagerDelegate();
|
||||
download_manager_ = new DownloadManagerImpl(download_manager_delegate_,
|
||||
NULL);
|
||||
download_manager_ =
|
||||
content::DownloadManager::Create(download_manager_delegate_, NULL);
|
||||
download_manager_delegate_->SetDownloadManager(download_manager_.get());
|
||||
download_manager_->Init(this);
|
||||
}
|
||||
|
|
|
@ -12,22 +12,21 @@
|
|||
#include "base/memory/scoped_ptr.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
|
||||
class DownloadManager;
|
||||
|
||||
namespace content {
|
||||
class DownloadManagerDelegate;
|
||||
class ResourceContext;
|
||||
class SpeechRecognitionPreferences;
|
||||
}
|
||||
|
||||
class CefBrowserMainParts;
|
||||
class CefDownloadManagerDelegate;
|
||||
|
||||
class CefBrowserContext : public content::BrowserContext {
|
||||
public:
|
||||
explicit CefBrowserContext(CefBrowserMainParts* main_parts);
|
||||
CefBrowserContext();
|
||||
virtual ~CefBrowserContext();
|
||||
|
||||
void InitWhileIOAllowed();
|
||||
|
||||
// BrowserContext methods.
|
||||
virtual FilePath GetPath() OVERRIDE;
|
||||
virtual bool IsOffTheRecord() const OVERRIDE;
|
||||
|
@ -56,8 +55,6 @@ class CefBrowserContext : public content::BrowserContext {
|
|||
scoped_refptr<content::SpeechRecognitionPreferences>
|
||||
speech_recognition_preferences_;
|
||||
|
||||
CefBrowserMainParts* main_parts_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
|
||||
};
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "base/bind_helpers.h"
|
||||
#include "content/browser/renderer_host/render_view_host_impl.h"
|
||||
#include "content/browser/renderer_host/resource_request_info_impl.h"
|
||||
#include "content/browser/tab_contents/tab_contents.h"
|
||||
#include "content/public/browser/navigation_controller.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
|
@ -124,12 +125,12 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
|||
const CefWindowInfo& window_info,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
TabContents* tab_contents,
|
||||
content::WebContents* web_contents,
|
||||
CefWindowHandle opener) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (tab_contents == NULL) {
|
||||
tab_contents = new TabContents(
|
||||
if (web_contents == NULL) {
|
||||
web_contents = content::WebContents::Create(
|
||||
_Context->browser_context(),
|
||||
NULL,
|
||||
MSG_ROUTING_NONE,
|
||||
|
@ -138,7 +139,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
|||
}
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
new CefBrowserHostImpl(window_info, settings, client, tab_contents,
|
||||
new CefBrowserHostImpl(window_info, settings, client, web_contents,
|
||||
opener);
|
||||
if (!browser->PlatformCreateWindow())
|
||||
return NULL;
|
||||
|
@ -267,8 +268,8 @@ void CefBrowserHostImpl::SetFocus(bool enable) {
|
|||
return;
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get())
|
||||
tab_contents_->Focus();
|
||||
if (web_contents_.get())
|
||||
web_contents_->Focus();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::SetFocus, this, enable));
|
||||
|
@ -302,8 +303,8 @@ bool CefBrowserHostImpl::CanGoBack() {
|
|||
|
||||
void CefBrowserHostImpl::GoBack() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get() && tab_contents_->GetController().CanGoBack())
|
||||
tab_contents_->GetController().GoBack();
|
||||
if (web_contents_.get() && web_contents_->GetController().CanGoBack())
|
||||
web_contents_->GetController().GoBack();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::GoBack, this));
|
||||
|
@ -317,8 +318,8 @@ bool CefBrowserHostImpl::CanGoForward() {
|
|||
|
||||
void CefBrowserHostImpl::GoForward() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get() && tab_contents_->GetController().CanGoForward())
|
||||
tab_contents_->GetController().GoForward();
|
||||
if (web_contents_.get() && web_contents_->GetController().CanGoForward())
|
||||
web_contents_->GetController().GoForward();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::GoForward, this));
|
||||
|
@ -332,8 +333,8 @@ bool CefBrowserHostImpl::IsLoading() {
|
|||
|
||||
void CefBrowserHostImpl::Reload() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get())
|
||||
tab_contents_->GetController().Reload(true);
|
||||
if (web_contents_.get())
|
||||
web_contents_->GetController().Reload(true);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::Reload, this));
|
||||
|
@ -342,8 +343,8 @@ void CefBrowserHostImpl::Reload() {
|
|||
|
||||
void CefBrowserHostImpl::ReloadIgnoreCache() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get())
|
||||
tab_contents_->GetController().ReloadIgnoringCache(true);
|
||||
if (web_contents_.get())
|
||||
web_contents_->GetController().ReloadIgnoringCache(true);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
|
||||
|
@ -352,8 +353,8 @@ void CefBrowserHostImpl::ReloadIgnoreCache() {
|
|||
|
||||
void CefBrowserHostImpl::StopLoad() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get())
|
||||
tab_contents_->Stop();
|
||||
if (web_contents_.get())
|
||||
web_contents_->Stop();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::StopLoad, this));
|
||||
|
@ -494,7 +495,7 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
|||
|
||||
registrar_.reset(NULL);
|
||||
content::WebContentsObserver::Observe(NULL);
|
||||
tab_contents_.reset(NULL);
|
||||
web_contents_.reset(NULL);
|
||||
|
||||
DetachAllFrames();
|
||||
|
||||
|
@ -506,14 +507,14 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
|||
|
||||
gfx::NativeView CefBrowserHostImpl::GetContentView() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!tab_contents_.get())
|
||||
if (!web_contents_.get())
|
||||
return NULL;
|
||||
return tab_contents_->GetNativeView();
|
||||
return web_contents_->GetNativeView();
|
||||
}
|
||||
|
||||
TabContents* CefBrowserHostImpl::GetTabContents() const {
|
||||
content::WebContents* CefBrowserHostImpl::GetWebContents() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return tab_contents_.get();
|
||||
return web_contents_.get();
|
||||
}
|
||||
|
||||
net::URLRequestContextGetter* CefBrowserHostImpl::GetRequestContext() {
|
||||
|
@ -560,8 +561,8 @@ void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
|
|||
|
||||
Send(new CefMsg_LoadRequest(routing_id(), request));
|
||||
|
||||
if (tab_contents_.get())
|
||||
tab_contents_->Focus();
|
||||
if (web_contents_.get())
|
||||
web_contents_->Focus();
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::LoadRequest(int64 frame_id,
|
||||
|
@ -594,7 +595,7 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) {
|
|||
if (frame_id == CefFrameHostImpl::kMainFrameId) {
|
||||
// Go through the navigation controller.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (tab_contents_.get()) {
|
||||
if (web_contents_.get()) {
|
||||
GURL gurl = GURL(url);
|
||||
|
||||
if (!gurl.is_valid() && !gurl.has_scheme()) {
|
||||
|
@ -612,12 +613,12 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id, const std::string& url) {
|
|||
// Update the loading URL.
|
||||
OnLoadingURLChange(gurl);
|
||||
|
||||
tab_contents_->GetController().LoadURL(
|
||||
web_contents_->GetController().LoadURL(
|
||||
gurl,
|
||||
content::Referrer(),
|
||||
content::PAGE_TRANSITION_TYPED,
|
||||
std::string());
|
||||
tab_contents_->Focus();
|
||||
web_contents_->Focus();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
|
@ -752,14 +753,14 @@ content::WebContents* CefBrowserHostImpl::OpenURLFromTab(
|
|||
}
|
||||
|
||||
void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source) {
|
||||
int current_index = tab_contents_->GetController().GetCurrentEntryIndex();
|
||||
int max_index = tab_contents_->GetController().GetEntryCount() - 1;
|
||||
int current_index = web_contents_->GetController().GetCurrentEntryIndex();
|
||||
int max_index = web_contents_->GetController().GetEntryCount() - 1;
|
||||
|
||||
bool is_loading, can_go_back, can_go_forward;
|
||||
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
is_loading = is_loading_ = tab_contents_->IsLoading();
|
||||
is_loading = is_loading_ = web_contents_->IsLoading();
|
||||
can_go_back = can_go_back_ = (current_index > 0);
|
||||
can_go_forward = can_go_forward_ = (current_index < max_index);
|
||||
}
|
||||
|
@ -777,7 +778,8 @@ bool CefBrowserHostImpl::ShouldCreateWebContents(
|
|||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const string16& frame_name) {
|
||||
const string16& frame_name,
|
||||
const GURL& target_url) {
|
||||
// Start with the current browser window's client and settings.
|
||||
pending_client_ = client_;
|
||||
pending_settings_ = settings_;
|
||||
|
@ -830,8 +832,8 @@ void CefBrowserHostImpl::WebContentsCreated(
|
|||
opener = GetBrowserForContents(source_contents)->GetWindowHandle();
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser = CefBrowserHostImpl::Create(
|
||||
pending_window_info_, pending_settings_, pending_client_,
|
||||
static_cast<TabContents*>(new_contents), opener);
|
||||
pending_window_info_, pending_settings_, pending_client_, new_contents,
|
||||
opener);
|
||||
if (browser.get() && !pending_url_.empty())
|
||||
browser->LoadURL(CefFrameHostImpl::kMainFrameId, pending_url_);
|
||||
|
||||
|
@ -1062,14 +1064,14 @@ void CefBrowserHostImpl::Observe(int type,
|
|||
CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
TabContents* tab_contents,
|
||||
content::WebContents* web_contents,
|
||||
CefWindowHandle opener)
|
||||
: content::WebContentsObserver(tab_contents),
|
||||
: content::WebContentsObserver(web_contents),
|
||||
window_info_(window_info),
|
||||
settings_(settings),
|
||||
client_(client),
|
||||
opener_(opener),
|
||||
render_process_id_(tab_contents->GetRenderProcessHost()->GetID()),
|
||||
render_process_id_(web_contents->GetRenderProcessHost()->GetID()),
|
||||
render_view_id_(routing_id()),
|
||||
unique_id_(0),
|
||||
received_page_title_(false),
|
||||
|
@ -1080,12 +1082,12 @@ CefBrowserHostImpl::CefBrowserHostImpl(const CefWindowInfo& window_info,
|
|||
queue_messages_(true),
|
||||
main_frame_id_(CefFrameHostImpl::kInvalidFrameId),
|
||||
focused_frame_id_(CefFrameHostImpl::kInvalidFrameId) {
|
||||
tab_contents_.reset(tab_contents);
|
||||
tab_contents->SetDelegate(this);
|
||||
web_contents_.reset(web_contents);
|
||||
web_contents->SetDelegate(this);
|
||||
|
||||
registrar_.reset(new content::NotificationRegistrar);
|
||||
registrar_->Add(this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
|
||||
content::Source<content::WebContents>(tab_contents));
|
||||
content::Source<content::WebContents>(web_contents));
|
||||
|
||||
placeholder_frame_ =
|
||||
new CefFrameHostImpl(this, CefFrameHostImpl::kInvalidFrameId, true);
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/string16.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "content/browser/tab_contents/tab_contents.h"
|
||||
#include "content/public/browser/notification_observer.h"
|
||||
#include "content/public/browser/notification_registrar.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/browser/web_contents_delegate.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
namespace net {
|
||||
class URLRequest;
|
||||
}
|
||||
|
||||
struct Cef_Request_Params;
|
||||
struct Cef_Response_Params;
|
||||
|
@ -36,14 +39,14 @@ class SiteInstance;
|
|||
|
||||
// Implementation of CefBrowser.
|
||||
//
|
||||
// WebContentsDelegate: Interface for handling TabContents delegations. There is
|
||||
// a one-to-one relationship between CefBrowserHostImpl and TabContents
|
||||
// WebContentsDelegate: Interface for handling WebContents delegations. There is
|
||||
// a one-to-one relationship between CefBrowserHostImpl and WebContents
|
||||
// instances.
|
||||
//
|
||||
// WebContentsObserver: Interface for observing TabContents notifications and
|
||||
// IPC messages. There is a one-to-one relationship between TabContents and
|
||||
// WebContentsObserver: Interface for observing WebContents notifications and
|
||||
// IPC messages. There is a one-to-one relationship between WebContents and
|
||||
// RenderViewHost instances. IPC messages received by the RenderViewHost will be
|
||||
// forwarded to this WebContentsObserver implementation via TabContents. IPC
|
||||
// forwarded to this WebContentsObserver implementation via WebContents. IPC
|
||||
// messages sent using CefBrowserHostImpl::Send() will be forwarded to the
|
||||
// RenderViewHost (after posting to the UI thread if necessary). Use
|
||||
// WebContentsObserver::routing_id() when sending IPC messages.
|
||||
|
@ -68,7 +71,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
const CefWindowInfo& window_info,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
TabContents* tab_contents,
|
||||
content::WebContents* web_contents,
|
||||
CefWindowHandle opener);
|
||||
|
||||
// Returns the browser associated with the specified RenderViewHost.
|
||||
|
@ -127,11 +130,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
// native browser window is not longer processing messages.
|
||||
void DestroyBrowser();
|
||||
|
||||
// Returns the native view for the TabContents.
|
||||
// Returns the native view for the WebContents.
|
||||
gfx::NativeView GetContentView() const;
|
||||
|
||||
// Returns a pointer to the TabContents.
|
||||
TabContents* GetTabContents() const;
|
||||
// Returns a pointer to the WebContents.
|
||||
content::WebContents* GetWebContents() const;
|
||||
|
||||
// Returns the browser-specific request context.
|
||||
net::URLRequestContextGetter* GetRequestContext();
|
||||
|
@ -188,7 +191,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
content::WebContents* web_contents,
|
||||
int route_id,
|
||||
WindowContainerType window_container_type,
|
||||
const string16& frame_name) OVERRIDE;
|
||||
const string16& frame_name,
|
||||
const GURL& target_url) OVERRIDE;
|
||||
virtual void WebContentsCreated(content::WebContents* source_contents,
|
||||
int64 source_frame_id,
|
||||
const GURL& target_url,
|
||||
|
@ -245,7 +249,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
CefBrowserHostImpl(const CefWindowInfo& window_info,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
TabContents* tab_contents,
|
||||
content::WebContents* web_contents,
|
||||
CefWindowHandle opener);
|
||||
|
||||
// Updates and returns an existing frame or creates a new frame. Pass
|
||||
|
@ -295,7 +299,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||
CefWindowInfo window_info_;
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_ptr<TabContents> tab_contents_;
|
||||
scoped_ptr<content::WebContents> web_contents_;
|
||||
CefWindowHandle opener_;
|
||||
|
||||
// Unique ids used for routing communication to/from the renderer. We keep a
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "base/bind.h"
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#include "content/public/common/renderer_preferences.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -82,13 +83,27 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
|||
AddRef();
|
||||
|
||||
// Parent the TabContents to the browser window.
|
||||
window_info_.widget = tab_contents_->GetView()->GetNativeView();
|
||||
window_info_.widget = web_contents_->GetView()->GetNativeView();
|
||||
gtk_container_add(GTK_CONTAINER(window_info_.parent_widget),
|
||||
window_info_.widget);
|
||||
|
||||
g_signal_connect(G_OBJECT(window_info_.widget), "destroy",
|
||||
G_CALLBACK(window_destroyed), this);
|
||||
|
||||
// As an additional requirement on Linux, we must set the colors for the
|
||||
// render widgets in webkit.
|
||||
content::RendererPreferences* prefs =
|
||||
web_contents_->GetMutableRendererPrefs();
|
||||
prefs->focus_ring_color = SkColorSetARGB(255, 229, 151, 0);
|
||||
prefs->thumb_active_color = SkColorSetRGB(244, 244, 244);
|
||||
prefs->thumb_inactive_color = SkColorSetRGB(234, 234, 234);
|
||||
prefs->track_color = SkColorSetRGB(211, 211, 211);
|
||||
|
||||
prefs->active_selection_bg_color = SkColorSetRGB(30, 144, 255);
|
||||
prefs->active_selection_fg_color = SK_ColorWHITE;
|
||||
prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200);
|
||||
prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "content/public/browser/web_contents_view.h"
|
||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||
#include "ui/gfx/rect.h"
|
||||
|
||||
|
||||
|
@ -38,43 +39,6 @@
|
|||
@end
|
||||
|
||||
|
||||
// Common base class for CEF browser windows. Contains methods relating to hole
|
||||
// punching required in order to display OpenGL underlay windows.
|
||||
@interface CefBrowserWindow : NSWindow {
|
||||
@private
|
||||
int underlaySurfaceCount_;
|
||||
}
|
||||
|
||||
// Informs the window that an underlay surface has been added/removed. The
|
||||
// window is non-opaque while underlay surfaces are present.
|
||||
- (void)underlaySurfaceAdded;
|
||||
- (void)underlaySurfaceRemoved;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CefBrowserWindow
|
||||
|
||||
- (void)underlaySurfaceAdded {
|
||||
DCHECK_GE(underlaySurfaceCount_, 0);
|
||||
++underlaySurfaceCount_;
|
||||
|
||||
// We're having the OpenGL surface render under the window, so the window
|
||||
// needs to be not opaque.
|
||||
if (underlaySurfaceCount_ == 1)
|
||||
[self setOpaque:NO];
|
||||
}
|
||||
|
||||
- (void)underlaySurfaceRemoved {
|
||||
--underlaySurfaceCount_;
|
||||
DCHECK_GE(underlaySurfaceCount_, 0);
|
||||
|
||||
if (underlaySurfaceCount_ == 0)
|
||||
[self setOpaque:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
bool CefBrowserHostImpl::PlatformViewText(const std::string& text) {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
|
@ -102,7 +66,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
|||
contentRect.size.width = window_rect.size.width;
|
||||
contentRect.size.height = window_rect.size.height;
|
||||
|
||||
newWnd = [[CefBrowserWindow alloc]
|
||||
newWnd = [[UnderlayOpenGLHostingWindow alloc]
|
||||
initWithContentRect:window_rect
|
||||
styleMask:(NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
|
@ -129,7 +93,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
|||
|
||||
// Parent the TabContents to the browser view.
|
||||
const NSRect bounds = [browser_view bounds];
|
||||
NSView* native_view = tab_contents_->GetView()->GetNativeView();
|
||||
NSView* native_view = web_contents_->GetView()->GetNativeView();
|
||||
[browser_view addSubview:native_view];
|
||||
[native_view setFrame:bounds];
|
||||
[native_view setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
|
||||
|
|
|
@ -129,9 +129,9 @@ LRESULT CALLBACK CefBrowserHostImpl::WndProc(HWND hwnd, UINT message,
|
|||
|
||||
case WM_SETFOCUS:
|
||||
if (browser) {
|
||||
TabContents* tab_contents = browser->GetTabContents();
|
||||
if (tab_contents)
|
||||
tab_contents->Focus();
|
||||
content::WebContents* web_contents = browser->GetWebContents();
|
||||
if (web_contents)
|
||||
web_contents->Focus();
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
@ -179,7 +179,7 @@ bool CefBrowserHostImpl::PlatformCreateWindow() {
|
|||
AddRef();
|
||||
|
||||
// Parent the TabContents to the browser window.
|
||||
SetParent(tab_contents_->GetView()->GetNativeView(), window_info_.window);
|
||||
SetParent(web_contents_->GetView()->GetNativeView(), window_info_.window);
|
||||
|
||||
// Size the web view window to the browser window.
|
||||
RECT cr;
|
||||
|
|
|
@ -55,7 +55,7 @@ int CefBrowserMainParts::PreCreateThreads() {
|
|||
}
|
||||
|
||||
void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
browser_context_.reset(new CefBrowserContext(this));
|
||||
browser_context_.reset(new CefBrowserContext());
|
||||
|
||||
PlatformInitialize();
|
||||
net::NetModule::SetResourceProvider(&ResourceProvider);
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "base/file_path.h"
|
||||
#include "content/public/browser/access_token_store.h"
|
||||
#include "content/public/browser/media_observer.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
@ -341,7 +342,9 @@ bool CefContentBrowserClient::CanCreateWindow(
|
|||
const GURL& origin,
|
||||
WindowContainerType container_type,
|
||||
content::ResourceContext* context,
|
||||
int render_process_id) {
|
||||
int render_process_id,
|
||||
bool* no_javascript_access) {
|
||||
*no_javascript_access = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||
const GURL& origin,
|
||||
WindowContainerType container_type,
|
||||
content::ResourceContext* context,
|
||||
int render_process_id) OVERRIDE;
|
||||
int render_process_id,
|
||||
bool* no_javascript_access) OVERRIDE;
|
||||
virtual std::string GetWorkerProcessTitle(
|
||||
const GURL& url, content::ResourceContext* context) OVERRIDE;
|
||||
virtual content::SpeechRecognitionManagerDelegate*
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
|
||||
CefDevToolsDelegate::CefDevToolsDelegate(
|
||||
int port,
|
||||
net::URLRequestContextGetter* context_getter)
|
||||
: context_getter_(context_getter) {
|
||||
net::URLRequestContextGetter* context_getter) {
|
||||
devtools_http_handler_ = content::DevToolsHttpHandler::Start(
|
||||
"127.0.0.1",
|
||||
port,
|
||||
"",
|
||||
context_getter,
|
||||
this);
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,6 @@ std::string CefDevToolsDelegate::GetDiscoveryPageHTML() {
|
|||
IDR_CEF_DEVTOOLS_DISCOVERY_PAGE).as_string();
|
||||
}
|
||||
|
||||
net::URLRequestContext*
|
||||
CefDevToolsDelegate::GetURLRequestContext() {
|
||||
return context_getter_->GetURLRequestContext();
|
||||
}
|
||||
|
||||
bool CefDevToolsDelegate::BundlesFrontendResources() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -30,12 +30,10 @@ class CefDevToolsDelegate : public content::DevToolsHttpHandlerDelegate {
|
|||
|
||||
// DevToolsHttpProtocolHandler::Delegate overrides.
|
||||
virtual std::string GetDiscoveryPageHTML() OVERRIDE;
|
||||
virtual net::URLRequestContext* GetURLRequestContext() OVERRIDE;
|
||||
virtual bool BundlesFrontendResources() OVERRIDE;
|
||||
virtual std::string GetFrontendResourcesBaseURL() OVERRIDE;
|
||||
|
||||
private:
|
||||
net::URLRequestContextGetter* context_getter_;
|
||||
content::DevToolsHttpHandler* devtools_http_handler_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsDelegate);
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
#include "base/logging.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
#include "content/browser/download/download_state_info.h"
|
||||
#include "content/browser/tab_contents/tab_contents.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "net/base/net_util.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
|
||||
#include "net/base/net_errors.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CefAuthCallbackImpl : public CefAuthCallback {
|
||||
|
|
|
@ -59,7 +59,7 @@ static NSAutoreleasePool* g_autopool = nil;
|
|||
|
||||
// Common base class for CEF browser windows. Contains methods relating to hole
|
||||
// punching required in order to display OpenGL underlay windows.
|
||||
@interface ClientWindow : NSWindow {
|
||||
@interface ClientWindow : NSWindow<CefUnderlayableSurface> {
|
||||
@private
|
||||
int underlaySurfaceCount_;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue