Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1303)

Unified Diff: chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc

Issue 489763002: MacViews: Gets a webview working in views_examples_with_content_exe Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to master Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
diff --git a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
index b8ccbd8fbbaff98432cb699efaba80a3df5a7d9d..081c3dbda2c38a05b8a02c63158bf3ab6dbfc291 100644
--- a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
+++ b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.h"
-#include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h"
#include "chrome/browser/ui/sad_tab_helper.h"
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
#include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.h"
@@ -15,12 +14,17 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
-#include "ui/aura/client/screen_position_client.h"
-#include "ui/aura/window.h"
+#include "content/public/browser/web_drag_dest_delegate.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/focus/view_storage.h"
#include "ui/views/widget/widget.h"
+#if !defined(OS_MACOSX)
+#include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h"
+#include "ui/aura/client/screen_position_client.h"
+#include "ui/aura/window.h"
+#endif
+
ChromeWebContentsViewDelegateViews::ChromeWebContentsViewDelegateViews(
content::WebContents* web_contents)
: ContextMenuDelegate(web_contents),
@@ -43,7 +47,9 @@ content::WebDragDestDelegate*
ChromeWebContentsViewDelegateViews::GetDragDestDelegate() {
// We install a chrome specific handler to intercept bookmark drags for the
// bookmark manager/extension API.
+#if !defined(OS_MACOSX)
bookmark_handler_.reset(new WebDragBookmarkHandlerAura);
+#endif
return bookmark_handler_.get();
}
@@ -65,26 +71,29 @@ bool ChromeWebContentsViewDelegateViews::Focus() {
return false;
}
-void ChromeWebContentsViewDelegateViews::TakeFocus(bool reverse) {
+bool ChromeWebContentsViewDelegateViews::TakeFocus(bool reverse) {
views::FocusManager* focus_manager = GetFocusManager();
if (focus_manager)
focus_manager->AdvanceFocus(reverse);
+ return true;
}
-void ChromeWebContentsViewDelegateViews::StoreFocus() {
+bool ChromeWebContentsViewDelegateViews::StoreFocus() {
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
view_storage->RemoveView(last_focused_view_storage_id_);
if (!GetFocusManager())
- return;
+ return true;
+
views::View* focused_view = GetFocusManager()->GetFocusedView();
if (focused_view)
view_storage->StoreView(last_focused_view_storage_id_, focused_view);
+ return true;
}
-void ChromeWebContentsViewDelegateViews::RestoreFocus() {
+bool ChromeWebContentsViewDelegateViews::RestoreFocus() {
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
views::View* last_focused_view =
view_storage->RetrieveView(last_focused_view_storage_id_);
@@ -105,6 +114,7 @@ void ChromeWebContentsViewDelegateViews::RestoreFocus() {
}
view_storage->RemoveView(last_focused_view_storage_id_);
}
+ return true;
}
scoped_ptr<RenderViewContextMenu> ChromeWebContentsViewDelegateViews::BuildMenu(
@@ -142,6 +152,7 @@ void ChromeWebContentsViewDelegateViews::ShowMenu(
gfx::Point screen_point(params.x, params.y);
+#if !defined(OS_MACOSX)
// Convert from target window coordinates to root window coordinates.
aura::Window* target_window = GetActiveNativeView();
aura::Window* root_window = target_window->GetRootWindow();
@@ -151,6 +162,8 @@ void ChromeWebContentsViewDelegateViews::ShowMenu(
screen_position_client->ConvertPointToScreen(target_window,
&screen_point);
}
+#endif
+
// Enable recursive tasks on the message loop so we can get updates while
// the context menu is being displayed.
base::MessageLoop::ScopedNestableTaskAllower allow(
@@ -175,7 +188,7 @@ void ChromeWebContentsViewDelegateViews::SizeChanged(const gfx::Size& size) {
sad_tab->GetWidget()->SetBounds(gfx::Rect(size));
}
-aura::Window* ChromeWebContentsViewDelegateViews::GetActiveNativeView() {
+gfx::NativeView ChromeWebContentsViewDelegateViews::GetActiveNativeView() {
return web_contents_->GetFullscreenRenderWidgetHostView() ?
web_contents_->GetFullscreenRenderWidgetHostView()->GetNativeView() :
web_contents_->GetNativeView();
@@ -202,9 +215,12 @@ void ChromeWebContentsViewDelegateViews::SetInitialFocus() {
namespace chrome {
+#if !defined(OS_MACOSX)
content::WebContentsViewDelegate* CreateWebContentsViewDelegate(
- content::WebContents* web_contents) {
+ content::WebContents* web_contents,
+ gfx::NativeView context) {
return new ChromeWebContentsViewDelegateViews(web_contents);
}
+#endif // !defined(OS_MACOSX)
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698