summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 23:37:22 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 23:37:22 +0000
commitda17b37430e97d518b7d640b98831c8e338b478c (patch)
tree65a777269f439c2b00b79d6f0e5c7ba140114461
parenta47fb6d0f441c34379c294f68cf8b2501cb36348 (diff)
downloadchromium_src-da17b37430e97d518b7d640b98831c8e338b478c.zip
chromium_src-da17b37430e97d518b7d640b98831c8e338b478c.tar.gz
chromium_src-da17b37430e97d518b7d640b98831c8e338b478c.tar.bz2
3rd step to remove BrowserExtender and to refactor BrowerView for sidebar.
* defined UIStyle enum * fixed #if for compact navbar so that it's enabled only on chromeos * Moved view initialization and layouts code from NormalExtender to chromeosBrowserView and ChromeosBrowsrViewLayoutManager respectively. * Removed unnecessary extender code from BrowserView. * no functional change BUG=none TEST=none Review URL: http://codereview.chromium.org/553059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36922 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc6
-rw-r--r--chrome/browser/browser.h2
-rw-r--r--chrome/browser/browser_window.h4
-rw-r--r--chrome/browser/chromeos/browser_extenders.cc316
-rw-r--r--chrome/browser/chromeos/chromeos_browser_view.cc362
-rw-r--r--chrome/browser/chromeos/chromeos_browser_view.h93
-rw-r--r--chrome/browser/views/frame/browser_extender.cc15
-rw-r--r--chrome/browser/views/frame/browser_extender.h56
-rw-r--r--chrome/browser/views/frame/browser_view.cc7
-rw-r--r--chrome/browser/views/frame/browser_view.h6
-rw-r--r--chrome/browser/views/frame/chrome_browser_view_layout_manager.cc7
-rw-r--r--chrome/browser/views/frame/standard_extender.cc20
12 files changed, 463 insertions, 431 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 3259fd6..fa5b781 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -988,7 +988,7 @@ void Browser::ToggleFullscreenMode() {
#endif
}
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
void Browser::ToggleCompactNavigationBar() {
UserMetrics::RecordAction("ToggleCompactNavigationBar", profile_);
window_->ToggleCompactNavigationBar();
@@ -1496,7 +1496,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break;
case IDC_FULLSCREEN: ToggleFullscreenMode(); break;
case IDC_EXIT: Exit(); break;
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
case IDC_COMPACT_NAVBAR: ToggleCompactNavigationBar(); break;
#endif
@@ -2496,7 +2496,7 @@ void Browser::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, true);
#endif
command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true);
#endif
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index e4effcb..9c4af82 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -360,7 +360,7 @@ class Browser : public TabStripModelDelegate,
// In kiosk mode, the first toggle is valid, the rest is discarded.
void ToggleFullscreenMode();
void Exit();
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
void ToggleCompactNavigationBar();
#endif
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index d6b311b..be215cc 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -282,10 +282,10 @@ class BrowserWindow {
// Shows the create web app shortcut dialog box.
virtual void ShowCreateShortcutsDialog(TabContents* tab_contents) = 0;
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
// Toggles compact navigation bar.
virtual void ToggleCompactNavigationBar() = 0;
-#endif // defined(TOOLKIT_VIEWS)
+#endif
// Construct a BrowserWindow implementation for the specified |browser|.
static BrowserWindow* CreateBrowserWindow(Browser* browser);
diff --git a/chrome/browser/chromeos/browser_extenders.cc b/chrome/browser/chromeos/browser_extenders.cc
index 1d2f7fa..9525f3f 100644
--- a/chrome/browser/chromeos/browser_extenders.cc
+++ b/chrome/browser/chromeos/browser_extenders.cc
@@ -9,6 +9,7 @@
#include "app/theme_provider.h"
#include "base/command_line.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/chromeos/chromeos_browser_view.h"
#include "chrome/browser/chromeos/compact_location_bar_host.h"
#include "chrome/browser/chromeos/compact_navigation_bar.h"
#include "chrome/browser/chromeos/main_menu.h"
@@ -28,19 +29,6 @@
namespace {
-const char* kChromeOsWindowManagerName = "chromeos-wm";
-const int kCompactNavbarSpaceHeight = 3;
-
-class Spacer : public views::View {
- SkBitmap* background_;
- public:
- explicit Spacer(SkBitmap* bitmap) : background_(bitmap) {}
-
- void Paint(gfx::Canvas* canvas) {
- canvas->TileImageInt(*background_, 0, 0, width(), height());
- }
-};
-
// NormalExtender adds ChromeOS specific controls and menus to a BrowserView
// created with Browser::TYPE_NORMAL. This extender adds controls to
// the title bar as follows:
@@ -50,275 +38,26 @@ class Spacer : public views::View {
// and adds the system context menu to the remaining arae of the titlebar.
//
// For Browser::TYPE_POPUP type of BrowserView, see PopupExtender class below.
-class NormalExtender : public BrowserExtender,
- public views::ButtonListener,
- public views::ContextMenuController {
+class NormalExtender : public BrowserExtender {
public:
- explicit NormalExtender(BrowserView* browser_view)
- : BrowserExtender(browser_view),
- main_menu_(NULL),
- status_area_(NULL),
- compact_navigation_bar_(NULL),
- // CompactNavigationBar is disabled by default.
- // TODO(oshima): Get this info from preference.
- compact_navigation_bar_enabled_(false),
- force_maximized_window_(false) {
+ explicit NormalExtender(chromeos::ChromeosBrowserView* browser_view)
+ : BrowserExtender(),
+ browser_view_(browser_view) {
}
virtual ~NormalExtender() {}
protected:
- // BrowserExtender overrides.
- virtual void Init() {
- main_menu_ = new views::ImageButton(this);
- ThemeProvider* theme_provider =
- browser_view()->frame()->GetThemeProviderForFrame();
- SkBitmap* image = theme_provider->GetBitmapNamed(IDR_MAIN_MENU_BUTTON);
- main_menu_->SetImage(views::CustomButton::BS_NORMAL, image);
- main_menu_->SetImage(views::CustomButton::BS_HOT, image);
- main_menu_->SetImage(views::CustomButton::BS_PUSHED, image);
- browser_view()->AddChildView(main_menu_);
-
- Browser* browser = browser_view()->browser();
- compact_location_bar_host_.reset(
- new chromeos::CompactLocationBarHost(browser_view()));
- compact_navigation_bar_ =
- new chromeos::CompactNavigationBar(browser_view());
- browser_view()->AddChildView(compact_navigation_bar_);
- compact_navigation_bar_->Init();
- status_area_ = new chromeos::StatusAreaView(browser_view());
- browser_view()->AddChildView(status_area_);
- status_area_->Init();
-
- SkBitmap* theme_toolbar = theme_provider->GetBitmapNamed(IDR_THEME_TOOLBAR);
- spacer_ = new Spacer(theme_toolbar);
- browser_view()->AddChildView(spacer_);
-
- InitSystemMenu();
- chromeos::MainMenu::ScheduleCreation();
-
- // The ContextMenuController has to be set to a NonClientView but
- // not to a NonClientFrameView because a TabStrip is not a child of
- // a NonClientFrameView even though visually a TabStrip is over a
- // NonClientFrameView.
- BrowserFrameGtk* gtk_frame =
- static_cast<BrowserFrameGtk*>(browser_view()->frame());
- gtk_frame->GetNonClientView()->SetContextMenuController(this);
-
- if (browser->type() == Browser::TYPE_NORMAL) {
- std::string wm_name;
- bool wm_name_valid = x11_util::GetWindowManagerName(&wm_name);
- // NOTE: On Chrome OS the wm and Chrome are started in parallel. This
- // means it's possible for us not to be able to get the name of the window
- // manager. We assume that when this happens we're on Chrome OS.
- force_maximized_window_ = (!wm_name_valid ||
- wm_name == kChromeOsWindowManagerName ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kChromeosFrame));
- }
- }
-
- virtual void Layout(const gfx::Rect& bounds,
- gfx::Rect* tabstrip_bounds,
- int* bottom) {
- if (browser_view()->IsTabStripVisible()) {
- *bottom = bounds.bottom();
- } else {
- *bottom = 0;
- }
- // Skip if there is no space to layout, or if the browser is in
- // fullscreen mode.
- if (bounds.IsEmpty() || browser_view()->IsFullscreen()) {
- main_menu_->SetVisible(false);
- compact_navigation_bar_->SetVisible(false);
- status_area_->SetVisible(false);
- tabstrip_bounds->SetRect(bounds.x(), bounds.y(),
- bounds.width(), bounds.height());
- return;
- } else {
- main_menu_->SetVisible(true);
- compact_navigation_bar_->SetVisible(compact_navigation_bar_enabled_);
- status_area_->SetVisible(true);
- }
-
- /* TODO(oshima):
- * Disabling the ability to update location bar on re-layout bacause
- * tabstrip state may not be in sync with the browser's state when
- * new tab is added. We should decide when we know more about this
- * feature. May be we should simply hide the location?
- * Filed a bug: http://crbug.com/30612.
- if (compact_navigation_bar_->IsVisible()) {
- // Update the size and location of the compact location bar.
- int index = browser_view()->browser()->selected_index();
- compact_location_bar_host_->Update(index, false);
- }
- */
-
- // Layout main menu before tab strip.
- gfx::Size main_menu_size = main_menu_->GetPreferredSize();
-
- // TODO(oshima): Use 0 for x position for now as this is
- // sufficient for chromeos where the window is always
- // maximized. The correct value is
- // OpaqueBrowserFrameView::NonClientBorderThickness() and we will
- // consider exposing it once we settle on the UI.
- main_menu_->SetBounds(0, bounds.y(),
- main_menu_size.width(), bounds.height());
-
- // Layout status area after tab strip.
- status_area_->Update();
- gfx::Size status_size = status_area_->GetPreferredSize();
- status_area_->SetBounds(bounds.x() + bounds.width() - status_size.width(),
- bounds.y(), status_size.width(),
- status_size.height());
- int curx = bounds.x();
- int width = bounds.width() - status_size.width();
-
- if (compact_navigation_bar_->IsVisible()) {
- gfx::Size cnb_bounds = compact_navigation_bar_->GetPreferredSize();
- // This (+1/-1) is a quick hack for the bug
- // http://code.google.com/p/chromium-os/issues/detail?id=1010
- // while investigating the issue. It could be in gtk or around
- // NativeViewHostGtk::CreateFixed, but it will take some time.
- compact_navigation_bar_->SetBounds(curx, bounds.y() + 1,
- cnb_bounds.width(),
- bounds.height() - 1);
- curx += cnb_bounds.width();
- width -= cnb_bounds.width();
-
- spacer_->SetVisible(true);
- spacer_->SetBounds(0, *bottom, browser_view()->width(),
- kCompactNavbarSpaceHeight);
- *bottom += kCompactNavbarSpaceHeight;
- } else {
- spacer_->SetVisible(false);
- }
- width = std::max(0, width); // In case there is no space left.
- tabstrip_bounds->SetRect(curx, bounds.y(), width, bounds.height());
- }
-
- virtual bool NonClientHitTest(const gfx::Point& point) {
- gfx::Point point_in_main_menu_coords(point);
- views::View::ConvertPointToView(browser_view(), main_menu_,
- &point_in_main_menu_coords);
- if (main_menu_->HitTest(point_in_main_menu_coords))
- return true;
-
- gfx::Point point_in_status_area_coords(point);
- views::View::ConvertPointToView(browser_view(), status_area_,
- &point_in_status_area_coords);
- if (status_area_->HitTest(point_in_status_area_coords))
- return true;
-
- if (compact_navigation_bar_->IsVisible()) {
- gfx::Point point_in_cnb_coords(point);
- views::View::ConvertPointToView(browser_view(),
- compact_navigation_bar_,
- &point_in_cnb_coords);
- return compact_navigation_bar_->HitTest(point_in_cnb_coords);
- }
- return false;
- }
-
- virtual bool ShouldForceHideToolbar() {
- return compact_navigation_bar_enabled_;
- }
-
- virtual bool SetFocusToCompactNavigationBar() {
- if (compact_navigation_bar_->IsFocusable()) {
- compact_navigation_bar_->FocusLocation();
- return true;
- } else {
- return false;
- }
- }
-
- virtual void ToggleCompactNavigationBar() {
- compact_navigation_bar_enabled_ = !compact_navigation_bar_enabled_;
- compact_navigation_bar_->SetFocusable(compact_navigation_bar_enabled_);
- compact_location_bar_host_->SetEnabled(compact_navigation_bar_enabled_);
- }
-
- virtual void OnMouseEnteredToTab(Tab* tab) {
- ShowCompactLocationBarUnderSelectedTab();
- }
-
- virtual void OnMouseMovedOnTab(Tab* tab) {
- // TODO(oshima): remove this method from extender once we settled
- // on the compact location bar behavior.
- }
-
- virtual void OnMouseExitedFromTab(Tab* tab) {
- // TODO(oshima): remove this method from extender once we settled
- // on the compact location bar behavior.
- }
virtual bool ShouldForceMaximizedWindow() {
- return force_maximized_window_;
+ return browser_view_->ShouldForceMaximizedWindow();
}
virtual int GetMainMenuWidth() const {
- return main_menu_->GetPreferredSize().width();
+ return browser_view_->GetMainMenuWidth();
}
private:
- // Shows the compact location bar under the selected tab.
- void ShowCompactLocationBarUnderSelectedTab() {
- if (!compact_navigation_bar_enabled_)
- return;
- int index = browser_view()->browser()->selected_index();
- compact_location_bar_host_->Update(index, true);
- }
-
- // Creates system menu.
- void InitSystemMenu() {
- system_menu_contents_.reset(new menus::SimpleMenuModel(browser_view()));
- system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB,
- IDS_RESTORE_TAB);
- system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
- system_menu_contents_->AddSeparator();
- system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER,
- IDS_TASK_MANAGER);
- system_menu_menu_.reset(new views::Menu2(system_menu_contents_.get()));
- }
-
- // views::ButtonListener overrides.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event) {
- chromeos::MainMenu::Show(browser_view()->browser());
- }
-
- // views::ContextMenuController overrides.
- virtual void ShowContextMenu(views::View* source,
- int x,
- int y,
- bool is_mouse_gesture) {
- system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
- }
-
- // Main menu button.
- views::ImageButton* main_menu_;
-
- // Status Area view.
- chromeos::StatusAreaView* status_area_;
-
- // System menus.
- scoped_ptr<menus::SimpleMenuModel> system_menu_contents_;
- scoped_ptr<views::Menu2> system_menu_menu_;
-
- // CompactNavigationBar view.
- chromeos::CompactNavigationBar* compact_navigation_bar_;
-
- // A toggle flag to show/hide the compact navigation bar.
- bool compact_navigation_bar_enabled_;
-
- // CompactLocationBarHost.
- scoped_ptr<chromeos::CompactLocationBarHost> compact_location_bar_host_;
-
- // A flag to specify if the browser window should be maximized.
- bool force_maximized_window_;
-
- // A spacer under the tap strip used when the compact navigation bar
- // is active.
- Spacer* spacer_;
+ chromeos::ChromeosBrowserView* browser_view_;
DISALLOW_COPY_AND_ASSIGN(NormalExtender);
};
@@ -328,42 +67,12 @@ class NormalExtender : public BrowserExtender,
// by window manager.
class PopupExtender : public BrowserExtender {
public:
- explicit PopupExtender(BrowserView* browser_view)
- : BrowserExtender(browser_view) {
+ explicit PopupExtender()
+ : BrowserExtender() {
}
virtual ~PopupExtender() {}
private:
- // BrowserExtender overrides.
- virtual void Init() {
- }
-
- virtual void Layout(const gfx::Rect& bounds,
- gfx::Rect* tabstrip_bounds,
- int* bottom) {
- NOTREACHED();
- }
-
- virtual bool NonClientHitTest(const gfx::Point& point) {
- return false;
- }
-
- virtual bool ShouldForceHideToolbar() {
- // Always hide toolbar for popups.
- return true;
- }
-
- virtual bool SetFocusToCompactNavigationBar() {
- return false;
- }
-
- virtual void ToggleCompactNavigationBar() {}
-
- virtual void OnMouseEnteredToTab(Tab* tab) {}
-
- virtual void OnMouseMovedOnTab(Tab* tab) {}
-
- virtual void OnMouseExitedFromTab(Tab* tab) {}
virtual bool ShouldForceMaximizedWindow() {
return false;
@@ -384,7 +93,8 @@ class PopupExtender : public BrowserExtender {
// static
BrowserExtender* BrowserExtender::Create(BrowserView* browser_view) {
if (browser_view->browser()->type() & Browser::TYPE_POPUP)
- return new PopupExtender(browser_view);
+ return new PopupExtender();
else
- return new NormalExtender(browser_view);
+ return new NormalExtender(
+ static_cast<chromeos::ChromeosBrowserView*>(browser_view));
}
diff --git a/chrome/browser/chromeos/chromeos_browser_view.cc b/chrome/browser/chromeos/chromeos_browser_view.cc
index 1a81995..69675a1 100644
--- a/chrome/browser/chromeos/chromeos_browser_view.cc
+++ b/chrome/browser/chromeos/chromeos_browser_view.cc
@@ -4,20 +4,58 @@
#include "chrome/browser/chromeos/chromeos_browser_view.h"
+#include "app/gfx/canvas.h"
+#include "app/menus/simple_menu_model.h"
+#include "app/theme_provider.h"
+#include "base/command_line.h"
+#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/chromeos/compact_location_bar_host.h"
+#include "chrome/browser/chromeos/compact_navigation_bar.h"
+#include "chrome/browser/chromeos/main_menu.h"
#include "chrome/browser/chromeos/panel_browser_view.h"
+#include "chrome/browser/chromeos/status_area_view.h"
+#include "chrome/browser/view_ids.h"
#include "chrome/browser/views/frame/browser_extender.h"
+#include "chrome/browser/views/frame/browser_frame_gtk.h"
+#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/frame/chrome_browser_view_layout_manager.h"
#include "chrome/browser/views/tabs/tab.h"
#include "chrome/browser/views/tabs/tab_overview_types.h"
#include "chrome/browser/views/tabs/tab_strip.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/x11_util.h"
+#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
+#include "views/controls/button/button.h"
+#include "views/controls/button/image_button.h"
+#include "views/controls/menu/menu_2.h"
+#include "views/window/hit_test.h"
#include "views/window/window.h"
namespace {
+const char* kChromeOsWindowManagerName = "chromeos-wm";
+const int kCompactNavbarSpaceHeight = 3;
+
+// A space we insert between the tabstrip and the content in
+// Compact mode.
+class Spacer : public views::View {
+ SkBitmap* background_;
+ public:
+ explicit Spacer(SkBitmap* bitmap) : background_(bitmap) {}
+
+ void Paint(gfx::Canvas* canvas) {
+ canvas->TileImageInt(*background_, 0, 0, width(), height());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Spacer);
+};
+
// A chromeos implementation of Tab that shows the compact location bar.
class ChromeosTab : public Tab {
public:
- ChromeosTab(TabStrip* tab_strip, const BrowserView* browser_view)
+ ChromeosTab(TabStrip* tab_strip, chromeos::ChromeosBrowserView* browser_view)
: Tab(tab_strip),
browser_view_(browser_view) {
}
@@ -26,20 +64,11 @@ class ChromeosTab : public Tab {
// Overridden from views::View.
virtual void OnMouseEntered(const views::MouseEvent& event) {
TabRenderer::OnMouseEntered(event);
- browser_view_->browser_extender()->OnMouseEnteredToTab(this);
- }
-
- virtual void OnMouseMoved(const views::MouseEvent& event) {
- browser_view_->browser_extender()->OnMouseMovedOnTab(this);
- }
-
- virtual void OnMouseExited(const views::MouseEvent& event) {
- TabRenderer::OnMouseExited(event);
- browser_view_->browser_extender()->OnMouseExitedFromTab(this);
+ browser_view_->ShowCompactLocationBarUnderSelectedTab();
}
private:
- const BrowserView* browser_view_;
+ chromeos::ChromeosBrowserView* browser_view_;
DISALLOW_COPY_AND_ASSIGN(ChromeosTab);
};
@@ -47,7 +76,8 @@ class ChromeosTab : public Tab {
// A Tabstrip that uses ChromeosTab as a Tab implementation.
class ChromeosTabStrip : public TabStrip {
public:
- ChromeosTabStrip(TabStripModel* model, const BrowserView* browser_view)
+ ChromeosTabStrip(TabStripModel* model,
+ chromeos::ChromeosBrowserView* browser_view)
: TabStrip(model), browser_view_(browser_view) {
}
virtual ~ChromeosTabStrip() {}
@@ -59,19 +89,58 @@ class ChromeosTabStrip : public TabStrip {
}
private:
- const BrowserView* browser_view_;
+ chromeos::ChromeosBrowserView* browser_view_;
DISALLOW_COPY_AND_ASSIGN(ChromeosTabStrip);
};
+// View ID used only in ChromeOS.
+enum ChromeOSViewIds {
+ // Start with the offset that is big enough to avoid possible
+ // collison.
+ VIEW_ID_MAIN_MENU = VIEW_ID_PREDEFINED_COUNT + 10000,
+ VIEW_ID_COMPACT_NAV_BAR,
+ VIEW_ID_STATUS_AREA,
+ VIEW_ID_SPACER,
+};
+
// LayoutManager for ChromeosBrowserView, which layouts extra components such as
-// main menu, stataus are via BrowserExtender.
+// main menu, stataus views.
class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
public:
ChromeosBrowserViewLayoutManager() : ChromeBrowserViewLayoutManager() {}
virtual ~ChromeosBrowserViewLayoutManager() {}
- // Overriden from ChromeBrowserViewLayoutManager.
+ //////////////////////////////////////////////////////////////////////////////
+ // ChromeBrowserViewLayoutManager overrides:
+
+ void Installed(views::View* host) {
+ main_menu_ = NULL;
+ compact_navigation_bar_ = NULL;
+ status_area_ = NULL;
+ spacer_ = NULL;
+ ChromeBrowserViewLayoutManager::Installed(host);
+ }
+
+ void ViewAdded(views::View* host,
+ views::View* view) {
+ ChromeBrowserViewLayoutManager::ViewAdded(host, view);
+ switch (view->GetID()) {
+ case VIEW_ID_SPACER:
+ spacer_ = view;
+ break;
+ case VIEW_ID_MAIN_MENU:
+ main_menu_ = view;
+ break;
+ case VIEW_ID_STATUS_AREA:
+ status_area_ = static_cast<chromeos::StatusAreaView*>(view);
+ break;
+ case VIEW_ID_COMPACT_NAV_BAR:
+ compact_navigation_bar_ = view;
+ break;
+ }
+ }
+
virtual int LayoutTabStrip() {
if (!browser_view_->IsTabStripVisible()) {
tabstrip_->SetVisible(false);
@@ -93,7 +162,7 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
int bottom = 0;
gfx::Rect tabstrip_bounds;
- browser_view_->browser_extender()->Layout(
+ LayoutCompactNavigationBar(
layout_bounds, &tabstrip_bounds, &bottom);
tabstrip_->SetVisible(true);
tabstrip_->SetBounds(tabstrip_bounds);
@@ -101,7 +170,141 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
}
}
+ virtual bool IsPositionInWindowCaption(const gfx::Point& point) {
+ return ChromeBrowserViewLayoutManager::IsPositionInWindowCaption(point)
+ && !IsPointInViewsInTitleArea(point);
+ }
+
+ virtual int NonClientHitTest(const gfx::Point& point) {
+ gfx::Point point_in_browser_view_coords(point);
+ views::View::ConvertPointToView(
+ browser_view_->GetParent(), browser_view_,
+ &point_in_browser_view_coords);
+ if (IsPointInViewsInTitleArea(point_in_browser_view_coords)) {
+ return HTCLIENT;
+ }
+ return ChromeBrowserViewLayoutManager::NonClientHitTest(point);
+ }
+
private:
+ chromeos::ChromeosBrowserView* chromeos_browser_view() {
+ return static_cast<chromeos::ChromeosBrowserView*>(browser_view_);
+ }
+
+ // Test if the point is on one of views that are within the
+ // considered title bar area of client view.
+ bool IsPointInViewsInTitleArea(const gfx::Point& point)
+ const {
+ gfx::Point point_in_main_menu_coords(point);
+ views::View::ConvertPointToView(browser_view_, main_menu_,
+ &point_in_main_menu_coords);
+ if (main_menu_->HitTest(point_in_main_menu_coords))
+ return true;
+
+ gfx::Point point_in_status_area_coords(point);
+ views::View::ConvertPointToView(browser_view_, status_area_,
+ &point_in_status_area_coords);
+ if (status_area_->HitTest(point_in_status_area_coords))
+ return true;
+
+ if (compact_navigation_bar_->IsVisible()) {
+ gfx::Point point_in_cnb_coords(point);
+ views::View::ConvertPointToView(browser_view_,
+ compact_navigation_bar_,
+ &point_in_cnb_coords);
+ return compact_navigation_bar_->HitTest(point_in_cnb_coords);
+ }
+ return false;
+ }
+
+ void LayoutCompactNavigationBar(const gfx::Rect& bounds,
+ gfx::Rect* tabstrip_bounds,
+ int* bottom) {
+ if (browser_view_->IsTabStripVisible()) {
+ *bottom = bounds.bottom();
+ } else {
+ *bottom = 0;
+ }
+ // Skip if there is no space to layout, or if the browser is in
+ // fullscreen mode.
+ if (bounds.IsEmpty() || browser_view_->IsFullscreen()) {
+ main_menu_->SetVisible(false);
+ compact_navigation_bar_->SetVisible(false);
+ status_area_->SetVisible(false);
+ tabstrip_bounds->SetRect(bounds.x(), bounds.y(),
+ bounds.width(), bounds.height());
+ return;
+ } else {
+ main_menu_->SetVisible(true);
+ compact_navigation_bar_->SetVisible(
+ chromeos_browser_view()->is_compact_style());
+ status_area_->SetVisible(true);
+ }
+
+ /* TODO(oshima):
+ * Disabling the ability to update location bar on re-layout bacause
+ * tabstrip state may not be in sync with the browser's state when
+ * new tab is added. We should decide when we know more about this
+ * feature. May be we should simply hide the location?
+ * Filed a bug: http://crbug.com/30612.
+ if (compact_navigation_bar_->IsVisible()) {
+ // Update the size and location of the compact location bar.
+ int index = browser_view()->browser()->selected_index();
+ compact_location_bar_host_->Update(index, false);
+ }
+ */
+
+ // Layout main menu before tab strip.
+ gfx::Size main_menu_size = main_menu_->GetPreferredSize();
+
+ // TODO(oshima): Use 0 for x position for now as this is
+ // sufficient for chromeos where the window is always
+ // maximized. The correct value is
+ // OpaqueBrowserFrameView::NonClientBorderThickness() and we will
+ // consider exposing it once we settle on the UI.
+ main_menu_->SetBounds(0, bounds.y(),
+ main_menu_size.width(), bounds.height());
+
+ status_area_->Update();
+ // Layout status area after tab strip.
+ gfx::Size status_size = status_area_->GetPreferredSize();
+ status_area_->SetBounds(bounds.x() + bounds.width() - status_size.width(),
+ bounds.y(), status_size.width(),
+ status_size.height());
+ int curx = bounds.x();
+ int remaining_width = bounds.width() - status_size.width();
+
+ if (compact_navigation_bar_->IsVisible()) {
+ gfx::Size cnb_bounds = compact_navigation_bar_->GetPreferredSize();
+ // This (+1/-1) is a quick hack for the bug
+ // http://code.google.com/p/chromium-os/issues/detail?id=1010
+ // while investigating the issue. It could be in gtk or around
+ // NativeViewHostGtk::CreateFixed, but it will take some time.
+ compact_navigation_bar_->SetBounds(curx, bounds.y() + 1,
+ cnb_bounds.width(),
+ bounds.height() - 1);
+ curx += cnb_bounds.width();
+ remaining_width -= cnb_bounds.width();
+
+ spacer_->SetVisible(true);
+ spacer_->SetBounds(0, *bottom, browser_view_->width(),
+ kCompactNavbarSpaceHeight);
+ *bottom += kCompactNavbarSpaceHeight;
+ } else {
+ spacer_->SetVisible(false);
+ }
+ // In case there is no space left.
+ remaining_width = std::max(0, remaining_width);
+ tabstrip_bounds->SetRect(curx, bounds.y(),
+ remaining_width, bounds.height());
+ }
+
+
+ views::View* main_menu_;
+ chromeos::StatusAreaView* status_area_;
+ views::View* compact_navigation_bar_;
+ views::View* spacer_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeosBrowserViewLayoutManager);
};
@@ -110,7 +313,69 @@ class ChromeosBrowserViewLayoutManager : public ChromeBrowserViewLayoutManager {
namespace chromeos {
ChromeosBrowserView::ChromeosBrowserView(Browser* browser)
- : BrowserView(browser) {
+ : BrowserView(browser),
+ main_menu_(NULL),
+ status_area_(NULL),
+ compact_navigation_bar_(NULL),
+ // Standard style is default.
+ // TODO(oshima): Get this info from preference.
+ ui_style_(StandardStyle),
+ force_maximized_window_(false) {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ChromeosBrowserView, ChromeBrowserView overrides:
+
+void ChromeosBrowserView::Init() {
+ BrowserView::Init();
+ main_menu_ = new views::ImageButton(this);
+ main_menu_->SetID(VIEW_ID_MAIN_MENU);
+ ThemeProvider* theme_provider =
+ frame()->GetThemeProviderForFrame();
+ SkBitmap* image = theme_provider->GetBitmapNamed(IDR_MAIN_MENU_BUTTON);
+ main_menu_->SetImage(views::CustomButton::BS_NORMAL, image);
+ main_menu_->SetImage(views::CustomButton::BS_HOT, image);
+ main_menu_->SetImage(views::CustomButton::BS_PUSHED, image);
+ AddChildView(main_menu_);
+
+ compact_location_bar_host_.reset(
+ new chromeos::CompactLocationBarHost(this));
+ compact_navigation_bar_ =
+ new chromeos::CompactNavigationBar(this);
+ compact_navigation_bar_->SetID(VIEW_ID_COMPACT_NAV_BAR);
+ AddChildView(compact_navigation_bar_);
+ compact_navigation_bar_->Init();
+ status_area_ = new chromeos::StatusAreaView(this);
+ status_area_->SetID(VIEW_ID_STATUS_AREA);
+ AddChildView(status_area_);
+ status_area_->Init();
+
+ SkBitmap* theme_toolbar = theme_provider->GetBitmapNamed(IDR_THEME_TOOLBAR);
+ spacer_ = new Spacer(theme_toolbar);
+ spacer_->SetID(VIEW_ID_SPACER);
+ AddChildView(spacer_);
+
+ InitSystemMenu();
+ chromeos::MainMenu::ScheduleCreation();
+
+ // The ContextMenuController has to be set to a NonClientView but
+ // not to a NonClientFrameView because a TabStrip is not a child of
+ // a NonClientFrameView even though visually a TabStrip is over a
+ // NonClientFrameView.
+ BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame());
+ gtk_frame->GetNonClientView()->SetContextMenuController(this);
+
+ if (browser()->type() == Browser::TYPE_NORMAL) {
+ std::string wm_name;
+ bool wm_name_valid = x11_util::GetWindowManagerName(&wm_name);
+ // NOTE: On Chrome OS the wm and Chrome are started in parallel. This
+ // means it's possible for us not to be able to get the name of the window
+ // manager. We assume that when this happens we're on Chrome OS.
+ force_maximized_window_ = (!wm_name_valid ||
+ wm_name == kChromeOsWindowManagerName ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kChromeosFrame));
+ }
}
void ChromeosBrowserView::Show() {
@@ -125,26 +390,81 @@ void ChromeosBrowserView::Show() {
}
bool ChromeosBrowserView::IsToolbarVisible() const {
- if (browser_extender()->ShouldForceHideToolbar())
+ if (is_compact_style())
return false;
return BrowserView::IsToolbarVisible();
}
void ChromeosBrowserView::SetFocusToLocationBar() {
- if (!browser_extender()->SetFocusToCompactNavigationBar()) {
+ if (compact_navigation_bar_->IsFocusable()) {
+ compact_navigation_bar_->FocusLocation();
+ } else {
BrowserView::SetFocusToLocationBar();
}
}
+void ChromeosBrowserView::ToggleCompactNavigationBar() {
+ ui_style_ = static_cast<UIStyle>((ui_style_ + 1) % 2);
+ compact_navigation_bar_->SetFocusable(is_compact_style());
+ compact_location_bar_host_->SetEnabled(is_compact_style());
+ Layout();
+}
+
views::LayoutManager* ChromeosBrowserView::CreateLayoutManager() const {
return new ChromeosBrowserViewLayoutManager();
}
TabStrip* ChromeosBrowserView::CreateTabStrip(
- TabStripModel* tab_strip_model) const {
+ TabStripModel* tab_strip_model) {
return new ChromeosTabStrip(tab_strip_model, this);
}
+// views::ButtonListener overrides.
+void ChromeosBrowserView::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
+ chromeos::MainMenu::Show(browser());
+}
+
+// views::ContextMenuController overrides.
+void ChromeosBrowserView::ShowContextMenu(views::View* source,
+ int x,
+ int y,
+ bool is_mouse_gesture) {
+ system_menu_menu_->RunMenuAt(gfx::Point(x, y), views::Menu2::ALIGN_TOPLEFT);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ChromeosBrowserView public:
+
+void ChromeosBrowserView::ShowCompactLocationBarUnderSelectedTab() {
+ if (!is_compact_style())
+ return;
+ int index = browser()->selected_index();
+ compact_location_bar_host_->Update(index, true);
+}
+
+bool ChromeosBrowserView::ShouldForceMaximizedWindow() const {
+ return force_maximized_window_;
+}
+
+int ChromeosBrowserView::GetMainMenuWidth() const {
+ return main_menu_->GetPreferredSize().width();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ChromeosBrowserView private:
+
+void ChromeosBrowserView::InitSystemMenu() {
+ system_menu_contents_.reset(new menus::SimpleMenuModel(this));
+ system_menu_contents_->AddItemWithStringId(IDC_RESTORE_TAB,
+ IDS_RESTORE_TAB);
+ system_menu_contents_->AddItemWithStringId(IDC_NEW_TAB, IDS_NEW_TAB);
+ system_menu_contents_->AddSeparator();
+ system_menu_contents_->AddItemWithStringId(IDC_TASK_MANAGER,
+ IDS_TASK_MANAGER);
+ system_menu_menu_.reset(new views::Menu2(system_menu_contents_.get()));
+}
+
} // namespace chromeos
// static
diff --git a/chrome/browser/chromeos/chromeos_browser_view.h b/chrome/browser/chromeos/chromeos_browser_view.h
index b96df66..b7a127e 100644
--- a/chrome/browser/chromeos/chromeos_browser_view.h
+++ b/chrome/browser/chromeos/chromeos_browser_view.h
@@ -9,23 +9,108 @@
class TabStripModel;
+namespace menus {
+class SimpleMenuModel;
+} // namespace menus
+
+namespace views {
+class ImageButton;
+class Menu2;
+} // namespace views
+
namespace chromeos {
-// ChromeosBrowserView implements Chromeos specific behavior of
-// BrowserView.
-class ChromeosBrowserView : public BrowserView {
+class CompactLocationBar;
+class CompactLocationBarHost;
+class CompactNavigationBar;
+class StatusAreaView;
+
+// ChromeosBrowserView adds ChromeOS specific controls and menus to a
+// BrowserView created with Browser::TYPE_NORMAL. This extender adds
+// controls to the title bar as follows:
+// ____ __ __
+// [MainMenu] / \ \ \ [StatusArea]
+//
+// and adds the system context menu to the remaining arae of the titlebar.
+class ChromeosBrowserView : public BrowserView,
+ public views::ButtonListener,
+ public views::ContextMenuController {
public:
+ // There are 3 ui styles, standard, compact and sidebar.
+ // Standard uses the same layout as chromium/chrome browser.
+ // Compact mode hides the omnibox/toolbar to save the vertical real estate,
+ // and uses QSB (compact nav bar) to launch/switch url. In sidebar mode,
+ // the tabstrip is moved to the side and the omnibox is moved on top of
+ // the tabstrip.
+ enum UIStyle {
+ StandardStyle,
+ CompactStyle,
+ SidebarStyle,
+ };
+
explicit ChromeosBrowserView(Browser* browser);
virtual ~ChromeosBrowserView() {}
// BrowserView overrides.
+ virtual void Init();
virtual void Show();
virtual bool IsToolbarVisible() const;
virtual void SetFocusToLocationBar();
+ virtual void ToggleCompactNavigationBar();
virtual views::LayoutManager* CreateLayoutManager() const;
- virtual TabStrip* CreateTabStrip(TabStripModel* tab_strip_model) const;
+ virtual TabStrip* CreateTabStrip(TabStripModel* tab_strip_model);
+
+ // views::ButtonListener overrides.
+ virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+
+ // views::ContextMenuController overrides.
+ virtual void ShowContextMenu(views::View* source,
+ int x,
+ int y,
+ bool is_mouse_gesture);
+
+ // Shows the compact location bar under the selected tab.
+ void ShowCompactLocationBarUnderSelectedTab();
+
+ // The following methods are temporarily defined for refactroing, and
+ // will be removed soon. See BrowserExtender class for the description.
+ bool ShouldForceMaximizedWindow() const;
+ int GetMainMenuWidth() const;
+
+ // Returns true if the ui style is in Compact mode.
+ bool is_compact_style() const {
+ return ui_style_ == CompactStyle;
+ }
private:
+ void InitSystemMenu();
+
+ // Main menu button.
+ views::ImageButton* main_menu_;
+
+ // Status Area view.
+ chromeos::StatusAreaView* status_area_;
+
+ // System menus.
+ scoped_ptr<menus::SimpleMenuModel> system_menu_contents_;
+ scoped_ptr<views::Menu2> system_menu_menu_;
+
+ // CompactNavigationBar view.
+ chromeos::CompactNavigationBar* compact_navigation_bar_;
+
+ // The current UI style of the browser.
+ UIStyle ui_style_;
+
+ // CompactLocationBarHost.
+ scoped_ptr<chromeos::CompactLocationBarHost> compact_location_bar_host_;
+
+ // A flag to specify if the browser window should be maximized.
+ bool force_maximized_window_;
+
+ // A spacer under the tap strip used when the compact navigation bar
+ // is active.
+ views::View* spacer_;
+
DISALLOW_COPY_AND_ASSIGN(ChromeosBrowserView);
};
diff --git a/chrome/browser/views/frame/browser_extender.cc b/chrome/browser/views/frame/browser_extender.cc
index ff4a1d6..f0178ba 100644
--- a/chrome/browser/views/frame/browser_extender.cc
+++ b/chrome/browser/views/frame/browser_extender.cc
@@ -4,20 +4,9 @@
#include "chrome/browser/views/frame/browser_extender.h"
-#include "chrome/browser/views/frame/browser_view.h"
-
////////////////////////////////////////////////////////////////////////////////
// BrowserExtender, public:
-BrowserExtender::BrowserExtender(BrowserView* browser_view)
- : browser_view_(browser_view),
- can_close_(true) {
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// BrowserExtender, protected:
-
-views::Window* BrowserExtender::GetBrowserWindow() {
- return browser_view_->frame()->GetWindow();
+BrowserExtender::BrowserExtender()
+ : can_close_(true) {
}
-
diff --git a/chrome/browser/views/frame/browser_extender.h b/chrome/browser/views/frame/browser_extender.h
index 4766fca..fcbc435 100644
--- a/chrome/browser/views/frame/browser_extender.h
+++ b/chrome/browser/views/frame/browser_extender.h
@@ -9,13 +9,10 @@
#include "base/gfx/rect.h"
class BrowserView;
-class Tab;
-
-namespace views {
-class Window;
-} // namespace views
-
+// Note: This class is deprecated (but still in use)
+// and will be removed in the near future.
+//
// BrowserExtender adds chromeos specific features to BrowserView.
// The factory method |Create(BrowserView*)| creates different types
// of extender depending on the type of BrowserView and target platform.
@@ -29,44 +26,9 @@ class BrowserExtender {
virtual ~BrowserExtender() {}
- // Initializes the extender.
- virtual void Init() = 0;
-
- // Layouts controls within the given bounds. The |tabstrip_bounds| will be
- // filled with the remaining bounds for tabstip to be layed out and
- // the |bottom| will be filled with the y location where toolbar should be
- // layed out, in BrowserView cooridnates.
- virtual void Layout(const gfx::Rect& bounds,
- gfx::Rect* tabstrip_bounds,
- int* bottom) = 0;
-
- // Tests if the given |point|, which is given in BrowserView coordinates,
- // hits any of controls.
- virtual bool NonClientHitTest(const gfx::Point& browser_view_point) = 0;
-
- // Returns true to hide the toolbar for the window, or false
- // to use the regular logic to decide.
- virtual bool ShouldForceHideToolbar() = 0;
-
// Returns true if the window should be in the maximized state.
virtual bool ShouldForceMaximizedWindow() = 0;
- // Returns true if the compact navigation bar is focusable and got
- // focus, false otherwise.
- virtual bool SetFocusToCompactNavigationBar() = 0;
-
- // Toggles the visibility of CompactNavigationBar.
- virtual void ToggleCompactNavigationBar() = 0;
-
- // Called when a mouse entered into the |tab|.
- virtual void OnMouseEnteredToTab(Tab* tab) = 0;
-
- // Called when a mouse moved (hovered) on the |tab|.
- virtual void OnMouseMovedOnTab(Tab* tab) = 0;
-
- // Called when a mouse exited from the |tab|.
- virtual void OnMouseExitedFromTab(Tab* tab) = 0;
-
// Returns the main menu's width. This is used in the opaque frame
// to layout otr icons and tabstrips.
virtual int GetMainMenuWidth() const = 0;
@@ -83,19 +45,9 @@ class BrowserExtender {
}
protected:
- explicit BrowserExtender(BrowserView* browser_view);
-
- // Returns the view Window object that contains the BrowserView.
- views::Window* GetBrowserWindow();
-
- BrowserView* browser_view() {
- return browser_view_;
- }
+ BrowserExtender();
private:
- // BrowserView to be extended.
- BrowserView* browser_view_;
-
// True if the browser can be closed. See set_can_close method for setails.
bool can_close_;
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 1c2da35..9cc01a3 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -1178,10 +1178,8 @@ void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
GetFocusManager());
}
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
void BrowserView::ToggleCompactNavigationBar() {
- browser_extender_->ToggleCompactNavigationBar();
- Layout();
}
#endif
@@ -1572,7 +1570,7 @@ views::LayoutManager* BrowserView::CreateLayoutManager() const {
return new ChromeBrowserViewLayoutManager();
}
-TabStrip* BrowserView::CreateTabStrip(TabStripModel* model) const {
+TabStrip* BrowserView::CreateTabStrip(TabStripModel* model) {
return new TabStrip(model);
}
@@ -1653,7 +1651,6 @@ void BrowserView::Init() {
#endif
browser_extender_.reset(BrowserExtender::Create(this));
- browser_extender_->Init();
}
#if defined(OS_WIN)
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 04d8a4e..2ba812a 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -289,9 +289,9 @@ class BrowserView : public BrowserWindow,
bool* is_keyboard_shortcut);
virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event);
virtual void ShowCreateShortcutsDialog(TabContents* tab_contents);
-#if defined(TOOLKIT_VIEWS)
+#if defined(OS_CHROMEOS)
virtual void ToggleCompactNavigationBar();
-#endif // defined(TOOLKIT_VIEWS)
+#endif // defined(OS_CHROMEOS)
// Overridden from BrowserWindowTesting:
virtual BookmarkBarView* GetBookmarkBarView() const;
@@ -374,7 +374,7 @@ class BrowserView : public BrowserWindow,
// Returns a new TabStrip for the browser view. A subclass may
// override to return a different TabStrip implementation.
- virtual TabStrip* CreateTabStrip(TabStripModel* tab_strip_model) const;
+ virtual TabStrip* CreateTabStrip(TabStripModel* tab_strip_model);
// Browser window related initializations.
virtual void Init();
diff --git a/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc b/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc
index dd37796..8994f75 100644
--- a/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc
+++ b/chrome/browser/views/frame/chrome_browser_view_layout_manager.cc
@@ -196,8 +196,7 @@ bool ChromeBrowserViewLayoutManager::IsPositionInWindowCaption(
const gfx::Point& point) {
gfx::Point tabstrip_point(point);
views::View::ConvertPointToView(browser_view_, tabstrip_, &tabstrip_point);
- return tabstrip_->IsPositionInWindowCaption(tabstrip_point)
- && !browser_view_->browser_extender()->NonClientHitTest(point);
+ return tabstrip_->IsPositionInWindowCaption(tabstrip_point);
}
int ChromeBrowserViewLayoutManager::NonClientHitTest(
@@ -240,10 +239,6 @@ int ChromeBrowserViewLayoutManager::NonClientHitTest(
}
}
- if (browser_view_->browser_extender()->NonClientHitTest(
- point_in_browser_view_coords))
- return HTCLIENT;
-
// If the point's y coordinate is below the top of the toolbar and otherwise
// within the bounds of this view, the point is considered to be within the
// client area.
diff --git a/chrome/browser/views/frame/standard_extender.cc b/chrome/browser/views/frame/standard_extender.cc
index e97c9d8..ae195d9 100644
--- a/chrome/browser/views/frame/standard_extender.cc
+++ b/chrome/browser/views/frame/standard_extender.cc
@@ -4,38 +4,22 @@
#include "chrome/browser/views/frame/browser_extender.h"
-#include "base/gfx/rect.h"
#include "chrome/browser/views/frame/browser_view.h"
-class Tab;
-
namespace {
// StandardExtender for non ChromeOS build. This currently adds/does nothing.
// TODO(oshima): Add MainMenu support with a command line flag.
class StandardExtender : public BrowserExtender {
public:
- explicit StandardExtender(BrowserView* browser_view)
- : BrowserExtender(browser_view) {
+ StandardExtender() : BrowserExtender() {
}
virtual ~StandardExtender() {}
private:
// BrowserExtender overrides.
- virtual void Init() {}
- virtual void Layout(const gfx::Rect& bounds,
- gfx::Rect* tabstrip_bounds,
- int* bottom) {
- NOTREACHED();
- }
virtual bool NonClientHitTest(const gfx::Point& point) { return false; }
- virtual bool ShouldForceHideToolbar() { return false; }
virtual bool ShouldForceMaximizedWindow() { return false; }
- virtual bool SetFocusToCompactNavigationBar() { return false; }
- virtual void ToggleCompactNavigationBar() {}
- virtual void OnMouseEnteredToTab(Tab* tab) {}
- virtual void OnMouseMovedOnTab(Tab* tab) {}
- virtual void OnMouseExitedFromTab(Tab* tab) {}
virtual int GetMainMenuWidth() const { return 0; }
DISALLOW_COPY_AND_ASSIGN(StandardExtender);
@@ -48,5 +32,5 @@ class StandardExtender : public BrowserExtender {
// static
BrowserExtender* BrowserExtender::Create(BrowserView* browser_view) {
- return new StandardExtender(browser_view);
+ return new StandardExtender();
}