diff options
author | raymes <raymes@chromium.org> | 2014-11-09 17:11:00 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-10 01:11:24 +0000 |
commit | 8bdca01518ca8f1443d5255adab9ebfa607c7850 (patch) | |
tree | 004563e2ea135ed4622a099e1ac1aa95a205d360 | |
parent | 7ba10bcafcd5cb74990cbae13b2bf2b0ef4d1ab4 (diff) | |
download | chromium_src-8bdca01518ca8f1443d5255adab9ebfa607c7850.zip chromium_src-8bdca01518ca8f1443d5255adab9ebfa607c7850.tar.gz chromium_src-8bdca01518ca8f1443d5255adab9ebfa607c7850.tar.bz2 |
Revert "MacViews: Get chrome/browser/ui/views/frame to compile"
This reverts commit f6158b090dc352608141ba8a9d8f09bbdbf4af88.
Speculative revert to attempt to fix https://code.google.com/p/chromium/issues/detail?id=431608
NOTREECHECKS=true
NOTRY=true
BUG=431608
TBR=tapted@chromium.org,andresantoso@chromium.org
Review URL: https://codereview.chromium.org/716463002
Cr-Commit-Position: refs/heads/master@{#303411}
22 files changed, 122 insertions, 289 deletions
diff --git a/build/common.gypi b/build/common.gypi index f792303..256515a 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -1510,9 +1510,6 @@ 'ozone_platform_ozonex%': 0, 'ozone_platform_test%': 0, - # Whether the browser is non-native (using Views Toolkit) on Mac. - 'mac_views_browser%': 0, - 'conditions': [ ['buildtype=="Official"', { # Continue to embed build meta data in Official builds, basically the diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index dcc96d7..f08a99f 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn @@ -224,13 +224,7 @@ static_library("ui") { gypi_values.chrome_browser_ui_views_non_chromeos_sources, ".", "//chrome") } - if (is_mac) { - if (mac_views_browser) { - sources -= [ "cocoa/browser_window_factory_cocoa.mm" ] - } else { - sources -= [ "views/frame/browser_window_factory.cc" ] - } - } else { + if (!is_mac) { sources += rebase_path( gypi_values.chrome_browser_ui_views_non_mac_sources, ".", "//chrome") diff --git a/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_factory.mm index 8a6214a..8a6214a 100644 --- a/chrome/browser/ui/cocoa/browser_window_factory_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_factory.mm diff --git a/chrome/browser/ui/views/frame/browser_command_handler_x11.cc b/chrome/browser/ui/views/frame/browser_command_handler_x11.cc index 4afe77a..ce37fcc 100644 --- a/chrome/browser/ui/views/frame/browser_command_handler_x11.cc +++ b/chrome/browser/ui/views/frame/browser_command_handler_x11.cc @@ -8,26 +8,15 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" -#include "chrome/browser/ui/views/frame/browser_view.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" -#include "ui/aura/window.h" #include "ui/events/event.h" #include "ui/events/event_utils.h" -BrowserCommandHandlerX11::BrowserCommandHandlerX11(BrowserView* browser_view) - : browser_view_(browser_view) { - aura::Window* window = browser_view_->frame()->GetNativeWindow(); - DCHECK(window); - if (window) - window->AddPreTargetHandler(this); -} +BrowserCommandHandlerX11::BrowserCommandHandlerX11(Browser* browser) + : browser_(browser) {} -BrowserCommandHandlerX11::~BrowserCommandHandlerX11() { - aura::Window* window = browser_view_->frame()->GetNativeWindow(); - if (window) - window->RemovePreTargetHandler(this); -} +BrowserCommandHandlerX11::~BrowserCommandHandlerX11() {} void BrowserCommandHandlerX11::OnMouseEvent(ui::MouseEvent* event) { if (event->type() != ui::ET_MOUSE_PRESSED) @@ -43,7 +32,7 @@ void BrowserCommandHandlerX11::OnMouseEvent(ui::MouseEvent* event) { const int kForwardMouseButton = 9; if (button == kBackMouseButton || button == kForwardMouseButton) { content::WebContents* contents = - browser_view_->browser()->tab_strip_model()->GetActiveWebContents(); + browser_->tab_strip_model()->GetActiveWebContents(); if (!contents) return; content::NavigationController& controller = contents->GetController(); diff --git a/chrome/browser/ui/views/frame/browser_command_handler_x11.h b/chrome/browser/ui/views/frame/browser_command_handler_x11.h index fdc9294..0542401 100644 --- a/chrome/browser/ui/views/frame/browser_command_handler_x11.h +++ b/chrome/browser/ui/views/frame/browser_command_handler_x11.h @@ -6,20 +6,19 @@ #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_COMMAND_HANDLER_X11_H_ #include "ui/events/event_handler.h" -#include "ui/gfx/native_widget_types.h" -class BrowserView; +class Browser; class BrowserCommandHandlerX11 : public ui::EventHandler { public: - explicit BrowserCommandHandlerX11(BrowserView* browser_view); + explicit BrowserCommandHandlerX11(Browser* browser); ~BrowserCommandHandlerX11() override; private: // ui::EventHandler: void OnMouseEvent(ui::MouseEvent* event) override; - BrowserView* browser_view_; + Browser* browser_; DISALLOW_COPY_AND_ASSIGN(BrowserCommandHandlerX11); }; diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index a4e9535..890d1de 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -4,11 +4,14 @@ #include "chrome/browser/ui/views/frame/browser_frame.h" +#include "ash/shell.h" +#include "base/command_line.h" #include "base/debug/leak_annotations.h" #include "base/i18n/rtl.h" #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window_state.h" @@ -20,7 +23,11 @@ #include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" #include "chrome/browser/ui/views/frame/system_menu_model_builder.h" #include "chrome/browser/ui/views/frame/top_container_view.h" +#include "chrome/browser/web_applications/web_app.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "ui/aura/window.h" +#include "ui/aura/window_event_dispatcher.h" #include "ui/base/hit_test.h" #include "ui/base/theme_provider.h" #include "ui/events/event_handler.h" @@ -29,9 +36,12 @@ #include "ui/views/controls/menu/menu_runner.h" #include "ui/views/widget/native_widget.h" +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) +#include "chrome/browser/shell_integration_linux.h" +#endif + #if defined(OS_CHROMEOS) #include "ash/session/session_state_delegate.h" -#include "ash/shell.h" #endif #if defined(USE_X11) @@ -52,9 +62,16 @@ BrowserFrame::BrowserFrame(BrowserView* browser_view) set_is_secondary_widget(false); // Don't focus anything on creation, selecting a tab will set the focus. set_focus_on_creation(false); + +#if defined(USE_X11) + browser_command_handler_.reset( + new BrowserCommandHandlerX11(browser_view_->browser())); +#endif } BrowserFrame::~BrowserFrame() { + if (browser_command_handler_ && GetNativeView()) + GetNativeView()->RemovePreTargetHandler(browser_command_handler_.get()); } // static @@ -73,8 +90,9 @@ void BrowserFrame::InitBrowserFrame() { native_browser_frame_ = NativeBrowserFrameFactory::CreateNativeBrowserFrame(this, browser_view_); - views::Widget::InitParams params = native_browser_frame_->GetWidgetParams(); + views::Widget::InitParams params; params.delegate = browser_view_; + params.native_widget = native_browser_frame_->AsNativeWidget(); if (browser_view_->browser()->is_type_tabbed()) { // Typed panel/popup can only return a size once the widget has been // created. @@ -82,9 +100,46 @@ void BrowserFrame::InitBrowserFrame() { ¶ms.bounds, ¶ms.show_state); } + + if (browser_view_->browser()->host_desktop_type() == + chrome::HOST_DESKTOP_TYPE_ASH || chrome::ShouldOpenAshOnStartup()) { + params.context = ash::Shell::GetPrimaryRootWindow(); +#if defined(OS_WIN) + // If this window is under ASH on Windows, we need it to be translucent. + params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; +#endif + } + +#if defined(OS_LINUX) && !defined(OS_CHROMEOS) + // Set up a custom WM_CLASS for some sorts of window types. This allows + // task switchers in X11 environments to distinguish between main browser + // windows and e.g app windows. + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); + const Browser& browser = *browser_view_->browser(); + params.wm_class_class = shell_integration_linux::GetProgramClassName(); + params.wm_class_name = params.wm_class_class; + if (browser.is_app() && !browser.is_devtools()) { + // This window is a hosted app or v1 packaged app. + // NOTE: v2 packaged app windows are created by ChromeNativeAppWindowViews. + params.wm_class_name = web_app::GetWMClassFromAppName(browser.app_name()); + } else if (command_line.HasSwitch(switches::kUserDataDir)) { + // Set the class name to e.g. "Chrome (/tmp/my-user-data)". The + // class name will show up in the alt-tab list in gnome-shell if + // you're running a binary that doesn't have a matching .desktop + // file. + const std::string user_data_dir = + command_line.GetSwitchValueNative(switches::kUserDataDir); + params.wm_class_name += " (" + user_data_dir + ")"; + } + const char kX11WindowRoleBrowser[] = "browser"; + const char kX11WindowRolePopup[] = "pop-up"; + params.wm_role_name = browser_view_->browser()->is_type_tabbed() ? + std::string(kX11WindowRoleBrowser) : std::string(kX11WindowRolePopup); + params.remove_standard_frame = UseCustomFrame(); set_frame_type(UseCustomFrame() ? Widget::FRAME_TYPE_FORCE_CUSTOM : Widget::FRAME_TYPE_FORCE_NATIVE); +#endif // defined(OS_LINUX) Init(params); @@ -93,9 +148,8 @@ void BrowserFrame::InitBrowserFrame() { non_client_view()->set_context_menu_controller(this); } -#if defined(USE_X11) - browser_command_handler_.reset(new BrowserCommandHandlerX11(browser_view_)); -#endif + if (browser_command_handler_) + GetNativeWindow()->AddPreTargetHandler(browser_command_handler_.get()); } void BrowserFrame::SetThemeProvider(scoped_ptr<ui::ThemeProvider> provider) { diff --git a/chrome/browser/ui/views/frame/browser_frame_ash.cc b/chrome/browser/ui/views/frame/browser_frame_ash.cc index 563f309d..9f576dc 100644 --- a/chrome/browser/ui/views/frame/browser_frame_ash.cc +++ b/chrome/browser/ui/views/frame/browser_frame_ash.cc @@ -4,7 +4,6 @@ #include "chrome/browser/ui/views/frame/browser_frame_ash.h" -#include "ash/shell.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_state.h" #include "ash/wm/window_state_delegate.h" @@ -18,6 +17,8 @@ #include "ui/aura/window_observer.h" #include "ui/views/view.h" +using aura::Window; + namespace { // BrowserWindowStateDelegate class handles a user's fullscreen @@ -126,17 +127,12 @@ void BrowserFrameAsh::GetWindowPlacement( //////////////////////////////////////////////////////////////////////////////// // BrowserFrameAsh, NativeBrowserFrame implementation: -views::Widget::InitParams BrowserFrameAsh::GetWidgetParams() { - views::Widget::InitParams params; - params.native_widget = this; - - params.context = ash::Shell::GetPrimaryRootWindow(); -#if defined(OS_WIN) - // If this window is under ASH on Windows, we need it to be translucent. - params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; -#endif +views::NativeWidget* BrowserFrameAsh::AsNativeWidget() { + return this; +} - return params; +const views::NativeWidget* BrowserFrameAsh::AsNativeWidget() const { + return this; } bool BrowserFrameAsh::UsesNativeSystemMenu() const { diff --git a/chrome/browser/ui/views/frame/browser_frame_ash.h b/chrome/browser/ui/views/frame/browser_frame_ash.h index 55c82be..bd827c6 100644 --- a/chrome/browser/ui/views/frame/browser_frame_ash.h +++ b/chrome/browser/ui/views/frame/browser_frame_ash.h @@ -34,7 +34,8 @@ class BrowserFrameAsh : public views::NativeWidgetAura, void OnWindowTargetVisibilityChanged(bool visible) override; // Overridden from NativeBrowserFrame: - views::Widget::InitParams GetWidgetParams() override; + views::NativeWidget* AsNativeWidget() override; + const views::NativeWidget* AsNativeWidget() const override; bool UsesNativeSystemMenu() const override; int GetMinimizeButtonOffset() const override; bool ShouldSaveWindowPlacement() const override; diff --git a/chrome/browser/ui/views/frame/browser_frame_mac.h b/chrome/browser/ui/views/frame/browser_frame_mac.h deleted file mode 100644 index 86f7445..0000000 --- a/chrome/browser/ui/views/frame/browser_frame_mac.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_MAC_H_ -#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_MAC_H_ - -#include "chrome/browser/ui/views/frame/native_browser_frame.h" -#include "ui/views/widget/native_widget_mac.h" - -class BrowserFrame; -class BrowserView; - -//////////////////////////////////////////////////////////////////////////////// -// BrowserFrameMac is a NativeWidgetMac subclass that provides -// the window frame for the Chrome browser window. -// -class BrowserFrameMac : public views::NativeWidgetMac, - public NativeBrowserFrame { - public: - BrowserFrameMac(BrowserFrame* browser_frame, BrowserView* browser_view); - - // Overridden from NativeBrowserFrame: - views::Widget::InitParams GetWidgetParams() override; - bool UsesNativeSystemMenu() const override; - bool ShouldSaveWindowPlacement() const override; - void GetWindowPlacement(gfx::Rect* bounds, - ui::WindowShowState* show_state) const override; - - protected: - ~BrowserFrameMac() override; - - // Overridden from NativeBrowserFrame: - int GetMinimizeButtonOffset() const override; - - private: - DISALLOW_COPY_AND_ASSIGN(BrowserFrameMac); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_MAC_H_ diff --git a/chrome/browser/ui/views/frame/browser_frame_mac.mm b/chrome/browser/ui/views/frame/browser_frame_mac.mm deleted file mode 100644 index ee6c55c6..0000000 --- a/chrome/browser/ui/views/frame/browser_frame_mac.mm +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/frame/browser_frame_mac.h" - -#include "chrome/browser/ui/views/frame/browser_frame.h" - -BrowserFrameMac::BrowserFrameMac(BrowserFrame* browser_frame, - BrowserView* browser_view) - : views::NativeWidgetMac(browser_frame) { -} - -BrowserFrameMac::~BrowserFrameMac() { -} - -//////////////////////////////////////////////////////////////////////////////// -// BrowserFrameMac, NativeBrowserFrame implementation: - -views::Widget::InitParams BrowserFrameMac::GetWidgetParams() { - views::Widget::InitParams params; - params.native_widget = this; - return params; -} - -bool BrowserFrameMac::UsesNativeSystemMenu() const { - return true; -} - -bool BrowserFrameMac::ShouldSaveWindowPlacement() const { - return true; -} - -void BrowserFrameMac::GetWindowPlacement( - gfx::Rect* bounds, - ui::WindowShowState* show_state) const { - return NativeWidgetMac::GetWindowPlacement(bounds, show_state); -} - -int BrowserFrameMac::GetMinimizeButtonOffset() const { - NOTIMPLEMENTED(); - return 0; -} diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 0720573..258cbd1 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -68,6 +68,7 @@ #include "chrome/browser/ui/views/frame/browser_view_layout_delegate.h" #include "chrome/browser/ui/views/frame/contents_layout_manager.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" +#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" #include "chrome/browser/ui/views/frame/top_container_view.h" #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" #include "chrome/browser/ui/views/fullscreen_exit_bubble_views.h" @@ -107,12 +108,14 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" -#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "grit/theme_resources.h" #include "ui/accessibility/ax_view_state.h" +#include "ui/aura/client/window_tree_client.h" +#include "ui/aura/window.h" +#include "ui/aura/window_tree_host.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/hit_test.h" #include "ui/base/l10n/l10n_util.h" @@ -135,12 +138,6 @@ #include "ui/views/widget/widget.h" #include "ui/views/window/dialog_delegate.h" -#if defined(USE_AURA) -#include "ui/aura/client/window_tree_client.h" -#include "ui/aura/window.h" -#include "ui/aura/window_tree_host.h" -#endif - #if defined(OS_WIN) #include "base/win/windows_version.h" #include "chrome/browser/jumplist_win.h" @@ -1419,7 +1416,6 @@ ToolbarView* BrowserView::GetToolbarView() const { void BrowserView::TabInsertedAt(WebContents* contents, int index, bool foreground) { -#if defined(USE_AURA) // WebContents inserted in tabs might not have been added to the root // window yet. Per http://crbug/342672 add them now since drawing the // WebContents requires root window specific data - information about @@ -1431,7 +1427,6 @@ void BrowserView::TabInsertedAt(WebContents* contents, window, root_window, root_window->GetBoundsInScreen()); DCHECK(contents->GetNativeView()->GetRootWindow()); } -#endif web_contents_close_handler_->TabInserted(); if (foreground) @@ -2371,6 +2366,24 @@ void BrowserView::UpdateAcceleratorMetrics(const ui::Accelerator& accelerator, #endif } +// static +BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { + // Create the view and the frame. The frame will attach itself via the view + // so we don't need to do anything with the pointer. + BrowserView* view = new BrowserView(); + view->Init(browser); + (new BrowserFrame(view))->InitBrowserFrame(); + view->GetWidget()->non_client_view()->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); + return view; +} + +// static +chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( + chrome::HostDesktopType desktop_type) { + return NativeBrowserFrameFactory::AdjustHostDesktopType(desktop_type); +} + void BrowserView::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) { gfx::Point origin(rect.origin()); @@ -2464,7 +2477,10 @@ void BrowserView::DoCutCopyPaste(void (WebContents::*method)(), bool BrowserView::DoCutCopyPasteForWebContents( WebContents* contents, void (WebContents::*method)()) { - if (contents->GetRenderWidgetHostView()->HasFocus()) { + gfx::NativeView native_view = contents->GetContentNativeView(); + if (!native_view) + return false; + if (native_view->HasFocus()) { (contents->*method)(); return true; } diff --git a/chrome/browser/ui/views/frame/browser_window_factory.cc b/chrome/browser/ui/views/frame/browser_window_factory.cc deleted file mode 100644 index 7db63a8..0000000 --- a/chrome/browser/ui/views/frame/browser_window_factory.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/frame/browser_frame.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" -#include "chrome/grit/chromium_strings.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/views/widget/widget.h" - -// static -BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { - // Create the view and the frame. The frame will attach itself via the view - // so we don't need to do anything with the pointer. - BrowserView* view = new BrowserView(); - view->Init(browser); - (new BrowserFrame(view))->InitBrowserFrame(); - view->GetWidget()->non_client_view()->SetAccessibleName( - l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); - return view; -} - -// static -chrome::HostDesktopType BrowserWindow::AdjustHostDesktopType( - chrome::HostDesktopType desktop_type) { - return NativeBrowserFrameFactory::AdjustHostDesktopType(desktop_type); -} diff --git a/chrome/browser/ui/views/frame/contents_web_view.cc b/chrome/browser/ui/views/frame/contents_web_view.cc index 68f0243..a86e39c 100644 --- a/chrome/browser/ui/views/frame/contents_web_view.cc +++ b/chrome/browser/ui/views/frame/contents_web_view.cc @@ -7,14 +7,11 @@ #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/ui/views/status_bubble_views.h" #include "content/public/browser/web_contents.h" +#include "ui/aura/window.h" #include "ui/base/theme_provider.h" #include "ui/compositor/layer_tree_owner.h" #include "ui/views/background.h" - -#if defined(USE_AURA) -#include "ui/aura/window.h" #include "ui/wm/core/window_util.h" -#endif ContentsWebView::ContentsWebView(content::BrowserContext* browser_context) : views::WebView(browser_context), @@ -86,11 +83,7 @@ void ContentsWebView::OnLayerRecreated(ui::Layer* old_layer, void ContentsWebView::CloneWebContentsLayer() { if (!web_contents()) return; -#if defined(USE_AURA) - // We don't need to clone the layers on non-Aura (Mac), because closing an - // NSWindow does not animate. cloned_layer_tree_ = wm::RecreateLayers(web_contents()->GetNativeView()); -#endif if (!cloned_layer_tree_ || !cloned_layer_tree_->root()) { cloned_layer_tree_.reset(); return; diff --git a/chrome/browser/ui/views/frame/desktop_browser_frame_aura.cc b/chrome/browser/ui/views/frame/desktop_browser_frame_aura.cc index 6063c76..d251f4f 100644 --- a/chrome/browser/ui/views/frame/desktop_browser_frame_aura.cc +++ b/chrome/browser/ui/views/frame/desktop_browser_frame_aura.cc @@ -4,13 +4,10 @@ #include "chrome/browser/ui/views/frame/desktop_browser_frame_aura.h" -#include "base/command_line.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/ui/views/frame/browser_desktop_window_tree_host.h" #include "chrome/browser/ui/views/frame/browser_shutdown.h" #include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/web_applications/web_app.h" -#include "chrome/common/chrome_switches.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" @@ -21,10 +18,6 @@ #include "ui/views/view.h" #include "ui/wm/core/visibility_controller.h" -#if defined(OS_LINUX) -#include "chrome/browser/shell_integration_linux.h" -#endif - using aura::Window; /////////////////////////////////////////////////////////////////////////////// @@ -81,39 +74,12 @@ void DesktopBrowserFrameAura::InitNativeWidget( //////////////////////////////////////////////////////////////////////////////// // DesktopBrowserFrameAura, NativeBrowserFrame implementation: -views::Widget::InitParams DesktopBrowserFrameAura::GetWidgetParams() { - views::Widget::InitParams params; - params.native_widget = this; - -#if defined(OS_LINUX) - // Set up a custom WM_CLASS for some sorts of window types. This allows - // task switchers in X11 environments to distinguish between main browser - // windows and e.g app windows. - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - const Browser& browser = *browser_view_->browser(); - params.wm_class_class = shell_integration_linux::GetProgramClassName(); - params.wm_class_name = params.wm_class_class; - if (browser.is_app() && !browser.is_devtools()) { - // This window is a hosted app or v1 packaged app. - // NOTE: v2 packaged app windows are created by ChromeNativeAppWindowViews. - params.wm_class_name = web_app::GetWMClassFromAppName(browser.app_name()); - } else if (command_line.HasSwitch(switches::kUserDataDir)) { - // Set the class name to e.g. "Chrome (/tmp/my-user-data)". The - // class name will show up in the alt-tab list in gnome-shell if - // you're running a binary that doesn't have a matching .desktop - // file. - const std::string user_data_dir = - command_line.GetSwitchValueNative(switches::kUserDataDir); - params.wm_class_name += " (" + user_data_dir + ")"; - } - const char kX11WindowRoleBrowser[] = "browser"; - const char kX11WindowRolePopup[] = "pop-up"; - params.wm_role_name = browser_view_->browser()->is_type_tabbed() ? - std::string(kX11WindowRoleBrowser) : std::string(kX11WindowRolePopup); -#endif // defined(OS_LINUX) - - return params; +views::NativeWidget* DesktopBrowserFrameAura::AsNativeWidget() { + return this; +} + +const views::NativeWidget* DesktopBrowserFrameAura::AsNativeWidget() const { + return this; } bool DesktopBrowserFrameAura::UsesNativeSystemMenu() const { diff --git a/chrome/browser/ui/views/frame/desktop_browser_frame_aura.h b/chrome/browser/ui/views/frame/desktop_browser_frame_aura.h index cd86478..901fa3e 100644 --- a/chrome/browser/ui/views/frame/desktop_browser_frame_aura.h +++ b/chrome/browser/ui/views/frame/desktop_browser_frame_aura.h @@ -41,7 +41,8 @@ class DesktopBrowserFrameAura : public views::DesktopNativeWidgetAura, void InitNativeWidget(const views::Widget::InitParams& params) override; // Overridden from NativeBrowserFrame: - views::Widget::InitParams GetWidgetParams() override; + views::NativeWidget* AsNativeWidget() override; + const views::NativeWidget* AsNativeWidget() const override; bool UsesNativeSystemMenu() const override; int GetMinimizeButtonOffset() const override; bool ShouldSaveWindowPlacement() const override; diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller.h b/chrome/browser/ui/views/frame/immersive_mode_controller.h index 2e059f3..6f24ddd 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller.h +++ b/chrome/browser/ui/views/frame/immersive_mode_controller.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ #define CHROME_BROWSER_UI_VIEWS_FRAME_IMMERSIVE_MODE_CONTROLLER_H_ +#include "ash/wm/immersive_revealed_lock.h" #include "base/compiler_specific.h" #include "base/observer_list.h" #include "chrome/browser/ui/host_desktop.h" @@ -16,16 +17,7 @@ class Rect; class Size; } -// A lock which will keep the top-of-window views revealed for its -// lifetime. -// See ImmersiveModeController::GetRevealedLock for details. -class ImmersiveRevealedLock { - public: - virtual ~ImmersiveRevealedLock() {} - - protected: - ImmersiveRevealedLock() {} -}; +typedef ash::ImmersiveRevealedLock ImmersiveRevealedLock; // Controller for an "immersive mode" similar to MacOS presentation mode where // the top-of-window views are hidden until the mouse hits the top of the @@ -90,7 +82,6 @@ class ImmersiveModeController { // If acquiring the lock causes a reveal, the top-of-window views will animate // according to |animate_reveal|. // The caller takes ownership of the returned lock. - // This is currently only supported on Ash. virtual ImmersiveRevealedLock* GetRevealedLock( AnimateReveal animate_reveal) WARN_UNUSED_RESULT = 0; diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc index 17928ea..d7f12d2 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash.cc @@ -5,7 +5,6 @@ #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" #include "ash/shell.h" -#include "ash/wm/immersive_revealed_lock.h" #include "ash/wm/window_state.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" @@ -41,17 +40,6 @@ ToImmersiveFullscreenControllerAnimateReveal( return ash::ImmersiveFullscreenController::ANIMATE_REVEAL_NO; } -class ImmersiveRevealedLockAsh : public ImmersiveRevealedLock { - public: - explicit ImmersiveRevealedLockAsh(ash::ImmersiveRevealedLock* lock) - : lock_(lock) {} - - private: - scoped_ptr<ash::ImmersiveRevealedLock> lock_; - - DISALLOW_COPY_AND_ASSIGN(ImmersiveRevealedLockAsh); -}; - } // namespace ImmersiveModeControllerAsh::ImmersiveModeControllerAsh() @@ -120,8 +108,8 @@ int ImmersiveModeControllerAsh::GetTopContainerVerticalOffset( ImmersiveRevealedLock* ImmersiveModeControllerAsh::GetRevealedLock( AnimateReveal animate_reveal) { - return new ImmersiveRevealedLockAsh(controller_->GetRevealedLock( - ToImmersiveFullscreenControllerAnimateReveal(animate_reveal))); + return controller_->GetRevealedLock( + ToImmersiveFullscreenControllerAnimateReveal(animate_reveal)); } void ImmersiveModeControllerAsh::OnFindBarVisibleBoundsChanged( diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_factory_ash.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_factory.cc index 1d8848a..7edd140 100644 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_factory_ash.cc +++ b/chrome/browser/ui/views/frame/immersive_mode_controller_factory.cc @@ -3,8 +3,8 @@ // found in the LICENSE file. #include "chrome/browser/ui/host_desktop.h" -#include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" #include "chrome/browser/ui/views/frame/immersive_mode_controller_stub.h" +#include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" namespace chrome { diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_factory_mac.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_factory_mac.cc deleted file mode 100644 index 9a0849f..0000000 --- a/chrome/browser/ui/views/frame/immersive_mode_controller_factory_mac.cc +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/frame/immersive_mode_controller_stub.h" - -namespace chrome { - -ImmersiveModeController* CreateImmersiveModeController( - chrome::HostDesktopType host_desktop_type) { - return new ImmersiveModeControllerStub(); -} - -} // namespace chrome diff --git a/chrome/browser/ui/views/frame/native_browser_frame.h b/chrome/browser/ui/views/frame/native_browser_frame.h index f1d2f38..846d9e7 100644 --- a/chrome/browser/ui/views/frame/native_browser_frame.h +++ b/chrome/browser/ui/views/frame/native_browser_frame.h @@ -7,7 +7,6 @@ #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" -#include "ui/views/widget/widget.h" class BrowserFrame; class BrowserView; @@ -20,8 +19,8 @@ class NativeBrowserFrame { public: virtual ~NativeBrowserFrame() {} - // Returns the platform specific InitParams for initializing our widget. - virtual views::Widget::InitParams GetWidgetParams() = 0; + virtual views::NativeWidget* AsNativeWidget() = 0; + virtual const views::NativeWidget* AsNativeWidget() const = 0; // Returns true if the OS takes care of showing the system menu. Returning // false means BrowserFrame handles showing the system menu. diff --git a/chrome/browser/ui/views/frame/native_browser_frame_factory_mac.cc b/chrome/browser/ui/views/frame/native_browser_frame_factory_mac.cc deleted file mode 100644 index 27ca192..0000000 --- a/chrome/browser/ui/views/frame/native_browser_frame_factory_mac.cc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/frame/native_browser_frame_factory.h" - -#include "chrome/browser/ui/views/frame/browser_frame_mac.h" - -NativeBrowserFrame* NativeBrowserFrameFactory::Create( - BrowserFrame* browser_frame, - BrowserView* browser_view) { - return new BrowserFrameMac(browser_frame, browser_view); -} diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 58b1acc..c1730a2 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -301,7 +301,7 @@ 'browser/ui/cocoa/browser_window_layout.mm', 'browser/ui/cocoa/browser_window_controller_private.h', 'browser/ui/cocoa/browser_window_controller_private.mm', - 'browser/ui/cocoa/browser_window_factory_cocoa.mm', + 'browser/ui/cocoa/browser_window_factory.mm', 'browser/ui/cocoa/browser_window_utils.h', 'browser/ui/cocoa/browser_window_utils.mm', 'browser/ui/cocoa/bubble_combobox.h', @@ -2006,11 +2006,9 @@ 'browser/ui/views/first_run_bubble.cc', 'browser/ui/views/first_run_bubble.h', 'browser/ui/views/frame/browser_frame.cc', - 'browser/ui/views/frame/browser_frame.h', 'browser/ui/views/frame/browser_frame_common_win.cc', 'browser/ui/views/frame/browser_frame_common_win.h', - 'browser/ui/views/frame/browser_frame_mac.h', - 'browser/ui/views/frame/browser_frame_mac.mm', + 'browser/ui/views/frame/browser_frame.h', 'browser/ui/views/frame/browser_non_client_frame_view.cc', 'browser/ui/views/frame/browser_non_client_frame_view_factory_aura.cc', 'browser/ui/views/frame/browser_non_client_frame_view.h', @@ -2023,7 +2021,6 @@ 'browser/ui/views/frame/browser_view_layout.cc', 'browser/ui/views/frame/browser_view_layout_delegate.h', 'browser/ui/views/frame/browser_view_layout.h', - 'browser/ui/views/frame/browser_window_factory.cc', 'browser/ui/views/frame/browser_window_property_manager_win.cc', 'browser/ui/views/frame/browser_window_property_manager_win.h', 'browser/ui/views/frame/contents_layout_manager.cc', @@ -2031,8 +2028,7 @@ 'browser/ui/views/frame/contents_web_view.cc', 'browser/ui/views/frame/contents_web_view.h', 'browser/ui/views/frame/immersive_mode_controller.cc', - 'browser/ui/views/frame/immersive_mode_controller_factory_ash.cc', - 'browser/ui/views/frame/immersive_mode_controller_factory_mac.cc', + 'browser/ui/views/frame/immersive_mode_controller_factory.cc', 'browser/ui/views/frame/immersive_mode_controller.h', 'browser/ui/views/frame/immersive_mode_controller_stub.cc', 'browser/ui/views/frame/immersive_mode_controller_stub.h', @@ -2041,7 +2037,6 @@ 'browser/ui/views/frame/native_browser_frame_factory.cc', 'browser/ui/views/frame/native_browser_frame_factory.h', 'browser/ui/views/frame/native_browser_frame_factory_chromeos.cc', - 'browser/ui/views/frame/native_browser_frame_factory_mac.cc', 'browser/ui/views/frame/native_browser_frame.h', 'browser/ui/views/frame/opaque_browser_frame_view_layout.cc', 'browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h', @@ -2803,15 +2798,7 @@ ['use_ash == 1', { 'sources': [ '<@(chrome_browser_ui_ash_views_sources)' ], }], - ['OS=="mac"', { - 'conditions': [ - ['mac_views_browser==1', { - 'sources!': [ 'browser/ui/cocoa/browser_window_factory_cocoa.mm', ], - }, { - 'sources!': [ 'browser/ui/views/frame/browser_window_factory.cc', ], - }], - ], - }, { + ['OS!="mac"', { 'sources': [ '<@(chrome_browser_ui_views_non_mac_sources)' ], 'dependencies': [ '<(DEPTH)/extensions/components/extensions_components.gyp:native_app_window', |