diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-22 22:21:57 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-22 22:21:57 +0000 |
commit | c2de68aeea9a829af41f087f2c3b3c347f7f196e (patch) | |
tree | 55438e660771845ef9d50e28ea39486d8ee72e8a | |
parent | 0d2292796fc314c5163dcd26234107df3cb819c4 (diff) | |
download | chromium_src-c2de68aeea9a829af41f087f2c3b3c347f7f196e.zip chromium_src-c2de68aeea9a829af41f087f2c3b3c347f7f196e.tar.gz chromium_src-c2de68aeea9a829af41f087f2c3b3c347f7f196e.tar.bz2 |
BrowserFrameView for ChromeOS.
* Introduced NormalBrowserFrameView, which can place OTR avatar icon in the right place.
- This is based on OpaqueBrowserFrameView, but a lot of stuff that are unnecessary in ChromeOS has been removed.
- Moved OTR Avatar icon view to BrowserView for now as this is much simpler to implement the above change. I'll revisit the possibility to refactor layout code to GetBoundsForXXX later.
* removed most of browser extender stuff.
BUG=chromium-os:1007
TEST=open incognito window and switch to compact navigation mode (ctrl-shift-c). incognito icon should be placed between
tabstrip and status area.
Review URL: http://codereview.chromium.org/593098
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39645 0039d316-1c4b-4281-b951-d872f2087c98
17 files changed, 663 insertions, 266 deletions
diff --git a/chrome/browser/chromeos/frame/browser_extenders.cc b/chrome/browser/chromeos/frame/browser_extenders.cc deleted file mode 100644 index 94eae29..0000000 --- a/chrome/browser/chromeos/frame/browser_extenders.cc +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2010 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 <algorithm> - -#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/frame/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" -#include "chrome/browser/chromeos/status/status_area_view.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/tabs/tab_strip.h" -#include "chrome/browser/views/toolbar_view.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" - -namespace { - -// 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: -// ____ __ __ -// [MainMenu] / \ \ \ [StatusArea] -// -// 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: - explicit NormalExtender(chromeos::BrowserView* browser_view) - : BrowserExtender(), - browser_view_(browser_view) { - } - virtual ~NormalExtender() {} - - protected: - - virtual bool ShouldForceMaximizedWindow() { - return browser_view_->ShouldForceMaximizedWindow(); - } - - virtual int GetMainMenuWidth() const { - return browser_view_->GetMainMenuWidth(); - } - - private: - chromeos::BrowserView* browser_view_; - - DISALLOW_COPY_AND_ASSIGN(NormalExtender); -}; - -// PopupExtender class creates dedicated title window for popup window. -// The size and location of the created title window is controlled by -// by window manager. -class PopupExtender : public BrowserExtender { - public: - explicit PopupExtender() - : BrowserExtender() { - } - virtual ~PopupExtender() {} - - private: - - virtual bool ShouldForceMaximizedWindow() { - return false; - } - - virtual int GetMainMenuWidth() const { - return 0; - } - - DISALLOW_COPY_AND_ASSIGN(PopupExtender); -}; - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// BrowserExtender, public: - -// static -BrowserExtender* BrowserExtender::Create(BrowserView* browser_view) { - if (browser_view->browser()->type() & Browser::TYPE_POPUP) - return new PopupExtender(); - else - return new NormalExtender( - static_cast<chromeos::BrowserView*>(browser_view)); -} diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc index 001ab0e..eb0435f 100644 --- a/chrome/browser/chromeos/frame/browser_frame_chromeos.cc +++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.cc @@ -4,6 +4,9 @@ #include "chrome/browser/chromeos/frame/browser_frame_chromeos.h" +#include "chrome/browser/chromeos/frame/normal_browser_frame_view.h" +#include "chrome/browser/views/frame/browser_view.h" + // static (Factory method.) BrowserFrame* BrowserFrame::Create(BrowserView* browser_view, Profile* profile) { @@ -24,8 +27,22 @@ BrowserFrameChromeos::~BrowserFrameChromeos() { } void BrowserFrameChromeos::Init() { - // TODO(oshima)::Create chromeos specific frame view. + // TODO(oshima): handle app panels. This currently uses the default + // implementation, which opens Chrome's app panel instead of + // ChromeOS's panel. + if (!IsPanel()) { + set_browser_frame_view(new NormalBrowserFrameView(this, browser_view())); + } BrowserFrameGtk::Init(); } +bool BrowserFrameChromeos::IsMaximized() const { + return !IsPanel() || WindowGtk::IsMaximized(); +} + +bool BrowserFrameChromeos::IsPanel() const { + return browser_view()->IsBrowserTypePanel() || + browser_view()->IsBrowserTypePopup(); +} + } // namespace chromeos diff --git a/chrome/browser/chromeos/frame/browser_frame_chromeos.h b/chrome/browser/chromeos/frame/browser_frame_chromeos.h index 23abbfa..b776591 100644 --- a/chrome/browser/chromeos/frame/browser_frame_chromeos.h +++ b/chrome/browser/chromeos/frame/browser_frame_chromeos.h @@ -17,6 +17,13 @@ class BrowserFrameChromeos : public BrowserFrameGtk { // BrowserFrameGtk overrides. virtual void Init(); + // views::WindowGtk overrides. + virtual bool IsMaximized() const; + + private: + // Returns true if the browser instance is for panel/popup window. + bool IsPanel() const; + DISALLOW_COPY_AND_ASSIGN(BrowserFrameChromeos); }; diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc index 3a6724d..2d7de4d 100644 --- a/chrome/browser/chromeos/frame/browser_view.cc +++ b/chrome/browser/chromeos/frame/browser_view.cc @@ -10,7 +10,6 @@ #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" @@ -29,8 +28,6 @@ #include "chrome/browser/views/tabs/tab_strip.h" #include "chrome/browser/views/toolbar_view.h" #include "chrome/browser/views/toolbar_star_toggle.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" @@ -41,7 +38,17 @@ namespace { -const char* kChromeOsWindowManagerName = "chromeos-wm"; +// The OTR avatar ends 2 px above the bottom of the tabstrip (which, given the +// way the tabstrip draws its bottom edge, will appear like a 1 px gap to the +// user). +const int kOTRBottomSpacing = 2; + +// There are 2 px on each side of the OTR avatar (between the frame border and +// it on the left, and between it and the tabstrip on the right). +const int kOTRSideSpacing = 2; + +// The size of the space between the content area and the tabstrip that is +// inserted in compact nvaigation bar mode. const int kCompactNavbarSpaceHeight = 3; // A space we insert between the tabstrip and the content in @@ -108,6 +115,7 @@ enum ChromeOSViewIds { VIEW_ID_COMPACT_NAV_BAR, VIEW_ID_STATUS_AREA, VIEW_ID_SPACER, + VIEW_ID_OTR_AVATAR, }; } // namespace @@ -115,7 +123,10 @@ enum ChromeOSViewIds { namespace chromeos { // LayoutManager for BrowserView, which layouts extra components such as -// main menu, stataus views. +// main menu, stataus views as follows: +// ____ __ __ +// [MainMenu] / \ \ \ [StatusArea] +// class BrowserViewLayout : public ::BrowserViewLayout { public: BrowserViewLayout() : ::BrowserViewLayout() {} @@ -148,35 +159,33 @@ class BrowserViewLayout : public ::BrowserViewLayout { case VIEW_ID_COMPACT_NAV_BAR: compact_navigation_bar_ = view; break; + case VIEW_ID_OTR_AVATAR: + otr_avatar_icon_ = view; + break; } } + // In the normal and the compact navigation bar mode, ChromeOS + // layouts compact navigation buttons and status views in the title + // area. See Layout virtual int LayoutTabStrip() { - if (!browser_view_->IsTabStripVisible()) { + if (browser_view_->IsFullscreen() || + !browser_view_->IsTabStripVisible()) { + main_menu_->SetVisible(false); + compact_navigation_bar_->SetVisible(false); + status_area_->SetVisible(false); + otr_avatar_icon_->SetVisible(false); tabstrip_->SetVisible(false); tabstrip_->SetBounds(0, 0, 0, 0); return 0; } else { gfx::Rect layout_bounds = browser_view_->frame()->GetBoundsForTabStrip(tabstrip_); - gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds(); - tabstrip_->SetBackgroundOffset( - gfx::Point(layout_bounds.x() - toolbar_bounds.x(), - layout_bounds.y())); gfx::Point tabstrip_origin = layout_bounds.origin(); views::View::ConvertPointToView(browser_view_->GetParent(), browser_view_, &tabstrip_origin); layout_bounds.set_origin(tabstrip_origin); - tabstrip_->SetVisible(true); - tabstrip_->SetBounds(layout_bounds); - - int bottom = 0; - gfx::Rect tabstrip_bounds; - LayoutCompactNavigationBar( - layout_bounds, &tabstrip_bounds, &bottom); - tabstrip_->SetVisible(true); - tabstrip_->SetBounds(tabstrip_bounds); - return bottom; + return LayoutTitlebarComponents(layout_bounds); } } @@ -199,7 +208,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { return static_cast<chromeos::BrowserView*>(browser_view_); } - // Test if the point is on one of views that are within the + // Tests 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 { @@ -225,29 +234,22 @@ class BrowserViewLayout : public ::BrowserViewLayout { 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); + // Layouts components in the title bar area (given by + // |bounds|). These include the main menu, the compact navigation + // buttons (in compact navbar mode), the otr avatar icon (in + // incognito window), the tabstrip and the the status area. + int LayoutTitlebarComponents(const gfx::Rect& bounds) { + if (bounds.IsEmpty()) { + return 0; } + main_menu_->SetVisible(true); + compact_navigation_bar_->SetVisible( + chromeos_browser_view()->is_compact_style()); + tabstrip_->SetVisible(true); + otr_avatar_icon_->SetVisible(browser_view_->ShouldShowOffTheRecordAvatar()); + status_area_->SetVisible(true); + + int bottom = bounds.bottom(); /* TODO(oshima): * Disabling the ability to update location bar on re-layout bacause @@ -264,12 +266,6 @@ class BrowserViewLayout : public ::BrowserViewLayout { // 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()); @@ -279,8 +275,9 @@ class BrowserViewLayout : public ::BrowserViewLayout { 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(); + LayoutOTRAvatar(bounds); + + int curx = bounds.x() + main_menu_size.width(); if (compact_navigation_bar_->IsVisible()) { gfx::Size cnb_size = compact_navigation_bar_->GetPreferredSize(); @@ -292,19 +289,41 @@ class BrowserViewLayout : public ::BrowserViewLayout { compact_navigation_bar_->SetBounds( cnb_bounds.Intersect(browser_view_->GetVisibleBounds())); curx += cnb_bounds.width(); - remaining_width -= cnb_bounds.width(); spacer_->SetVisible(true); - spacer_->SetBounds(0, *bottom, browser_view_->width(), + spacer_->SetBounds(0, bottom, browser_view_->width(), kCompactNavbarSpaceHeight); - *bottom += kCompactNavbarSpaceHeight; + bottom += kCompactNavbarSpaceHeight; } else { + compact_navigation_bar_->SetBounds(curx, bounds.y(), 0, 0); 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()); + int remaining_width = std::max( + 0, // In case there is no space left. + otr_avatar_icon_->bounds().x() - + compact_navigation_bar_->bounds().right()); + tabstrip_->SetBounds(curx, bounds.y(), remaining_width, bounds.height()); + + gfx::Rect toolbar_bounds = browser_view_->GetToolbarBounds(); + tabstrip_->SetBackgroundOffset( + gfx::Point(curx - toolbar_bounds.x(), + bounds.y())); + return bottom; + } + + // Layouts OTR avatar within the given |bounds|. + void LayoutOTRAvatar(const gfx::Rect& bounds) { + gfx::Rect status_bounds = status_area_->bounds(); + if (!otr_avatar_icon_->IsVisible()) { + otr_avatar_icon_->SetBounds(status_bounds.x(), status_bounds.y(), 0, 0); + } else { + gfx::Size preferred_size = otr_avatar_icon_->GetPreferredSize(); + + int y = bounds.bottom() - preferred_size.height() - kOTRBottomSpacing; + int x = status_bounds.x() - kOTRSideSpacing - preferred_size.width(); + otr_avatar_icon_->SetBounds(x, y, preferred_size.width(), + preferred_size.height()); + } } @@ -312,6 +331,7 @@ class BrowserViewLayout : public ::BrowserViewLayout { chromeos::StatusAreaView* status_area_; views::View* compact_navigation_bar_; views::View* spacer_; + views::View* otr_avatar_icon_; DISALLOW_COPY_AND_ASSIGN(BrowserViewLayout); }; @@ -324,7 +344,9 @@ BrowserView::BrowserView(Browser* browser) // Standard style is default. // TODO(oshima): Get this info from preference. ui_style_(StandardStyle), - force_maximized_window_(false) { + force_maximized_window_(false), + spacer_(NULL), + otr_avatar_icon_(new views::ImageView()) { } BrowserView::~BrowserView() { @@ -374,17 +396,9 @@ void BrowserView::Init() { 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)); - } + otr_avatar_icon_->SetImage(GetOTRAvatarIcon()); + otr_avatar_icon_->SetID(VIEW_ID_OTR_AVATAR); + AddChildView(otr_avatar_icon_); } void BrowserView::Show() { @@ -494,14 +508,6 @@ void BrowserView::ShowCompactLocationBarUnderSelectedTab() { compact_location_bar_host_->Update(index, true); } -bool BrowserView::ShouldForceMaximizedWindow() const { - return force_maximized_window_; -} - -int BrowserView::GetMainMenuWidth() const { - return main_menu_->GetPreferredSize().width(); -} - //////////////////////////////////////////////////////////////////////////////// // BrowserView private: diff --git a/chrome/browser/chromeos/frame/browser_view.h b/chrome/browser/chromeos/frame/browser_view.h index fe6a65e..e4a57ef 100644 --- a/chrome/browser/chromeos/frame/browser_view.h +++ b/chrome/browser/chromeos/frame/browser_view.h @@ -85,11 +85,6 @@ class BrowserView : public ::BrowserView, // 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; @@ -124,6 +119,9 @@ class BrowserView : public ::BrowserView, // is active. views::View* spacer_; + // Off the record icon. + views::ImageView* otr_avatar_icon_; + // Menu button shown in status area when browser is in compact mode. StatusAreaButton* menu_view_; diff --git a/chrome/browser/chromeos/frame/normal_browser_frame_view.cc b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc new file mode 100644 index 0000000..a2e202c --- /dev/null +++ b/chrome/browser/chromeos/frame/normal_browser_frame_view.cc @@ -0,0 +1,414 @@ +// Copyright (c) 2010 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/chromeos/frame/normal_browser_frame_view.h" + +#include "app/gfx/canvas.h" +#include "app/gfx/font.h" +#include "app/gfx/path.h" +#include "app/l10n_util.h" +#include "app/resource_bundle.h" +#include "app/theme_provider.h" +#include "base/command_line.h" +#include "base/compiler_specific.h" +#include "chrome/browser/browser_theme_provider.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/browser/views/frame/browser_extender.h" +#include "chrome/browser/views/frame/browser_frame.h" +#include "chrome/browser/views/frame/browser_view.h" +#include "chrome/browser/views/tabs/tab_strip.h" +#include "chrome/common/chrome_switches.h" +#include "grit/app_resources.h" +#include "grit/chromium_strings.h" +#include "grit/generated_resources.h" +#include "grit/theme_resources.h" +#include "views/controls/button/image_button.h" +#include "views/controls/image_view.h" +#include "views/widget/root_view.h" +#include "views/window/window.h" +#include "views/window/window_resources.h" + +#if defined(OS_WIN) +#include "app/win_util.h" +#endif + +#if defined(OS_LINUX) +#include "chrome/common/x11_util.h" +#include "views/window/hit_test.h" +#endif + +const int kCustomFrameBackgroundVerticalOffset = 15; + +namespace { +// The frame border is usually 0 as chromeos has no border. The border +// can be enabled (4px fixed) with the command line option +// "--chromeos-frame" so that one can resize the window on dev machine. +const int kFrameBorderThickness = 0; +const int kFrameBorderThicknessForDev = 4; + +// While resize areas on Windows are normally the same size as the window +// borders, our top area is shrunk by 1 px to make it easier to move the window +// around with our thinner top grabbable strip. (Incidentally, our side and +// bottom resize areas don't match the frame border thickness either -- they +// span the whole nonclient area, so there's no "dead zone" for the mouse.) + +const int kTopResizeAdjust = 1; +// In the window corners, the resize areas don't actually expand bigger, but the +// 16 px at the end of each edge triggers diagonal resizing. + +const int kResizeAreaCornerSize = 16; +// The icon is inset 2 px from the left frame border. + +const int kIconLeftSpacing = 2; +// The titlebar has a 2 px 3D edge along the top and bottom. + +const int kTitlebarTopAndBottomEdgeThickness = 2; + +// The top 1 px of the tabstrip is shadow; in maximized mode we push this off +// the top of the screen so the tabs appear flush against the screen edge. +const int kTabstripTopShadowThickness = 1; +} // namespace + +namespace chromeos { + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, public: + +NormalBrowserFrameView::NormalBrowserFrameView(BrowserFrame* frame, + BrowserView* browser_view) + : BrowserNonClientFrameView(), + frame_(frame), + browser_view_(browser_view) { + // Normal window does not have the window title/icon. + DCHECK(!browser_view_->ShouldShowWindowIcon()); + DCHECK(!browser_view_->ShouldShowWindowTitle()); + DCHECK(!frame_->GetWindow()->GetDelegate()->ShouldShowWindowTitle()); + DCHECK(!frame_->GetWindow()->GetDelegate()->ShouldShowWindowIcon()); +} + +NormalBrowserFrameView::~NormalBrowserFrameView() { +} + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, BrowserNonClientFrameView implementation: + +gfx::Rect NormalBrowserFrameView::GetBoundsForTabStrip( + BaseTabStrip* tabstrip) const { + int x_offset = 0; + int tabstrip_x = NonClientBorderThickness() + x_offset; + int tabstrip_width = RightEdge() - tabstrip_x; + + return gfx::Rect(tabstrip_x, NonClientTopBorderHeight(), + std::max(0, tabstrip_width), + tabstrip->GetPreferredHeight()); +} + +void NormalBrowserFrameView::UpdateThrobber(bool running) { + // No window icon. +} + +gfx::Size NormalBrowserFrameView::GetMinimumSize() { + gfx::Size min_size(browser_view_->GetMinimumSize()); + int border_thickness = NonClientBorderThickness(); + min_size.Enlarge(2 * border_thickness, + NonClientTopBorderHeight() + border_thickness); + + int min_titlebar_width = (2 * FrameBorderThickness()) + kIconLeftSpacing; + min_size.set_width(std::max(min_size.width(), min_titlebar_width)); + return min_size; +} + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, views::NonClientFrameView implementation: + +gfx::Rect NormalBrowserFrameView::GetBoundsForClientView() const { + return client_view_bounds_; +} + +bool NormalBrowserFrameView::AlwaysUseNativeFrame() const { + return frame_->AlwaysUseNativeFrame(); +} + +gfx::Rect NormalBrowserFrameView::GetWindowBoundsForClientBounds( + const gfx::Rect& client_bounds) const { + int top_height = NonClientTopBorderHeight(); + int border_thickness = NonClientBorderThickness(); + return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), + std::max(0, client_bounds.y() - top_height), + client_bounds.width() + (2 * border_thickness), + client_bounds.height() + top_height + border_thickness); +} + +int NormalBrowserFrameView::NonClientHitTest(const gfx::Point& point) { + if (!bounds().Contains(point)) + return HTNOWHERE; + int frame_component = + frame_->GetWindow()->GetClientView()->NonClientHitTest(point); + if (frame_component != HTNOWHERE) + return frame_component; + int window_component = GetHTComponentForFrame(point, TopResizeHeight(), + NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, + frame_->GetWindow()->GetDelegate()->CanResize()); + // Fall back to the caption if no other component matches. + return (window_component == HTNOWHERE) ? HTCAPTION : window_component; +} + +void NormalBrowserFrameView::GetWindowMask(const gfx::Size& size, + gfx::Path* window_mask) { + DCHECK(window_mask); + // Always maximized. +} + +void NormalBrowserFrameView::EnableClose(bool enable) { + // No close button +} + +void NormalBrowserFrameView::ResetWindowControls() { +} + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, views::View overrides: + +void NormalBrowserFrameView::Paint(gfx::Canvas* canvas) { + views::Window* window = frame_->GetWindow(); + if (window->IsFullscreen()) + return; // Nothing is visible, so don't bother to paint. + + PaintMaximizedFrameBorder(canvas); + PaintToolbarBackground(canvas); +} + +void NormalBrowserFrameView::Layout() { + LayoutClientView(); +} + +bool NormalBrowserFrameView::HitTest(const gfx::Point& l) const { + // If the point is outside the bounds of the client area, claim it. + bool in_nonclient = NonClientFrameView::HitTest(l); + if (in_nonclient) + return in_nonclient; + + // Otherwise claim it only if it's in a non-tab portion of the tabstrip. + if (l.y() > browser_view_->tabstrip()->bounds().bottom()) + return false; + + // We convert from our parent's coordinates since we assume we fill its bounds + // completely. We need to do this since we're not a parent of the tabstrip, + // meaning ConvertPointToView would otherwise return something bogus. + gfx::Point browser_view_point(l); + View::ConvertPointToView(GetParent(), browser_view_, &browser_view_point); + return browser_view_->IsPositionInWindowCaption(browser_view_point); +} + +void NormalBrowserFrameView::ViewHierarchyChanged(bool is_add, + views::View* parent, + views::View* child) { + if (is_add && child == this) { + // The Accessibility glue looks for the product name on these two views to + // determine if this is in fact a Chrome window. + GetRootView()->SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME)); + } +} + +bool NormalBrowserFrameView::GetAccessibleRole(AccessibilityTypes::Role* role) { + DCHECK(role); + + *role = AccessibilityTypes::ROLE_TITLEBAR; + return true; +} + +bool NormalBrowserFrameView::GetAccessibleName(std::wstring* name) { + DCHECK(name); + + if (!accessible_name_.empty()) { + *name = accessible_name_; + return true; + } + return false; +} + +void NormalBrowserFrameView::SetAccessibleName(const std::wstring& name) { + accessible_name_ = name; +} + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, TabIconView::TabContentsProvider implementation: + +bool NormalBrowserFrameView::ShouldTabIconViewAnimate() const { + // This function is queried during the creation of the window as the + // TabIconView we host is initialized, so we need to NULL check the selected + // TabContents because in this condition there is not yet a selected tab. + TabContents* current_tab = browser_view_->GetSelectedTabContents(); + return current_tab ? current_tab->is_loading() : false; +} + +SkBitmap NormalBrowserFrameView::GetFavIconForTabIconView() { + return frame_->GetWindow()->GetDelegate()->GetWindowIcon(); +} + +/////////////////////////////////////////////////////////////////////////////// +// NormalBrowserFrameView, private: + +int NormalBrowserFrameView::FrameBorderThickness() const { + static int border_thickness_ = + CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeosFrame) ? + kFrameBorderThicknessForDev : kFrameBorderThickness; + return border_thickness_; +} + +int NormalBrowserFrameView::TopResizeHeight() const { + return FrameBorderThickness() - kTopResizeAdjust; +} + +int NormalBrowserFrameView::NonClientBorderThickness() const { + return FrameBorderThickness(); +} + +int NormalBrowserFrameView::NonClientTopBorderHeight() const { + if (browser_view_->IsTabStripVisible()) + return FrameBorderThickness() - kTabstripTopShadowThickness; + + return FrameBorderThickness(); +} + +int NormalBrowserFrameView::RightEdge() const { + return width() - FrameBorderThickness(); +} + +void NormalBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { + ThemeProvider* tp = GetThemeProvider(); + views::Window* window = frame_->GetWindow(); + + // Window frame mode and color + SkBitmap* theme_frame; + int y = 0; + // Never theme app and popup windows. + if (!browser_view_->IsBrowserTypeNormal()) { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + if (ShouldPaintAsActive()) + theme_frame = rb.GetBitmapNamed(IDR_FRAME); + else + theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); + } else if (!browser_view_->IsOffTheRecord()) { + theme_frame = ShouldPaintAsActive() ? + tp->GetBitmapNamed(IDR_THEME_FRAME) : + tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); + // TODO(oshima): gtk based CHROMEOS is using non custom frame + // mode which does this adjustment. This should be removed + // once it's fully migrated to views. -1 is due to the layout + // difference between views and gtk and will be removed. + // See http://crbug.com/28580. + y = -kCustomFrameBackgroundVerticalOffset - 1; + } else { + theme_frame = ShouldPaintAsActive() ? + tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO) : + tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); + y = -kCustomFrameBackgroundVerticalOffset - 1; + } + // Draw the theme frame. + canvas->TileImageInt(*theme_frame, 0, y, width(), theme_frame->height()); + + // Draw the theme frame overlay + if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && + browser_view_->IsBrowserTypeNormal()) { + SkBitmap* theme_overlay = ShouldPaintAsActive() ? + tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY) : + tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); + canvas->DrawBitmapInt(*theme_overlay, 0, 0); + } + + if (!browser_view_->IsToolbarVisible()) { + // There's no toolbar to edge the frame border, so we need to draw a bottom + // edge. The graphic we use for this has a built in client edge, so we clip + // it off the bottom. + SkBitmap* top_center = + tp->GetBitmapNamed(IDR_APP_TOP_CENTER); + int edge_height = top_center->height() - kClientEdgeThickness; + canvas->TileImageInt(*top_center, 0, + window->GetClientView()->y() - edge_height, width(), edge_height); + } +} + +void NormalBrowserFrameView::PaintToolbarBackground(gfx::Canvas* canvas) { + if (!browser_view_->IsToolbarVisible()) + return; + + gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); + if (toolbar_bounds.IsEmpty()) + return; + + ThemeProvider* tp = GetThemeProvider(); + gfx::Point toolbar_origin(toolbar_bounds.origin()); + View::ConvertPointToView(frame_->GetWindow()->GetClientView(), + this, &toolbar_origin); + toolbar_bounds.set_origin(toolbar_origin); + + SkColor theme_toolbar_color = + tp->GetColor(BrowserThemeProvider::COLOR_TOOLBAR); + canvas->FillRectInt(theme_toolbar_color, + toolbar_bounds.x(), toolbar_bounds.y() + 2, + toolbar_bounds.width(), toolbar_bounds.height() - 2); + + int strip_height = browser_view_->GetTabStripHeight(); + SkBitmap* theme_toolbar = tp->GetBitmapNamed(IDR_THEME_TOOLBAR); + + canvas->TileImageInt(*theme_toolbar, + toolbar_bounds.x() - 1, strip_height - 1, // crop src + toolbar_bounds.x() - 1, toolbar_bounds.y() + 2, + toolbar_bounds.width() + 2, theme_toolbar->height()); + + SkBitmap* toolbar_left = + tp->GetBitmapNamed(IDR_CONTENT_TOP_LEFT_CORNER); + + // Gross hack: We split the toolbar images into two pieces, since sometimes + // (popup mode) the toolbar isn't tall enough to show the whole image. The + // split happens between the top shadow section and the bottom gradient + // section so that we never break the gradient. + int split_point = kFrameShadowThickness * 2; + int bottom_y = toolbar_bounds.y() + split_point; + int bottom_edge_height = + std::min(toolbar_left->height(), toolbar_bounds.height()) - split_point; + + canvas->DrawBitmapInt(*toolbar_left, 0, 0, toolbar_left->width(), split_point, + toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y(), + toolbar_left->width(), split_point, false); + canvas->DrawBitmapInt(*toolbar_left, 0, + toolbar_left->height() - bottom_edge_height, toolbar_left->width(), + bottom_edge_height, toolbar_bounds.x() - toolbar_left->width(), bottom_y, + toolbar_left->width(), bottom_edge_height, false); + + SkBitmap* toolbar_center = + tp->GetBitmapNamed(IDR_CONTENT_TOP_CENTER); + canvas->TileImageInt(*toolbar_center, 0, 0, toolbar_bounds.x(), + toolbar_bounds.y(), toolbar_bounds.width(), split_point); + + SkBitmap* toolbar_right = tp->GetBitmapNamed(IDR_CONTENT_TOP_RIGHT_CORNER); + canvas->DrawBitmapInt(*toolbar_right, 0, 0, toolbar_right->width(), + split_point, toolbar_bounds.right(), toolbar_bounds.y(), + toolbar_right->width(), split_point, false); + canvas->DrawBitmapInt(*toolbar_right, 0, + toolbar_right->height() - bottom_edge_height, toolbar_right->width(), + bottom_edge_height, toolbar_bounds.right(), bottom_y, + toolbar_right->width(), bottom_edge_height, false); + + // Draw the content/toolbar separator. + canvas->DrawLineInt(ResourceBundle::toolbar_separator_color, + toolbar_bounds.x(), toolbar_bounds.bottom() - 1, + toolbar_bounds.right() - 1, toolbar_bounds.bottom() - 1); +} + +void NormalBrowserFrameView::LayoutClientView() { + client_view_bounds_ = CalculateClientAreaBounds(width(), height()); +} + +gfx::Rect NormalBrowserFrameView::CalculateClientAreaBounds(int width, + int height) const { + int top_height = NonClientTopBorderHeight(); + int border_thickness = NonClientBorderThickness(); + return gfx::Rect(border_thickness, top_height, + std::max(0, width - (2 * border_thickness)), + std::max(0, height - top_height - border_thickness)); +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/frame/normal_browser_frame_view.h b/chrome/browser/chromeos/frame/normal_browser_frame_view.h new file mode 100644 index 0000000..b6838ee --- /dev/null +++ b/chrome/browser/chromeos/frame/normal_browser_frame_view.h @@ -0,0 +1,114 @@ +// Copyright (c) 2010 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_CHROMEOS_FRAME_NORMAL_BROWSER_FRAME_VIEW_H_ +#define CHROME_BROWSER_CHROMEOS_FRAME_NORMAL_BROWSER_FRAME_VIEW_H_ + +#include "chrome/browser/views/frame/browser_frame.h" +#include "chrome/browser/views/frame/browser_non_client_frame_view.h" +#include "chrome/browser/views/tab_icon_view.h" +#include "views/controls/button/button.h" +#include "views/window/non_client_view.h" + +class BaseTabStrip; +class BrowserView; +namespace gfx { +class Font; +} +class TabContents; +namespace views { +class ImageButton; +class ImageView; +} + +namespace chromeos { + +class NormalBrowserFrameView : public BrowserNonClientFrameView, + public TabIconView::TabIconViewModel { + public: + // Constructs a non-client view for an BrowserFrame. + NormalBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); + virtual ~NormalBrowserFrameView(); + + // Overridden from BrowserNonClientFrameView: + virtual gfx::Rect GetBoundsForTabStrip(BaseTabStrip* tabstrip) const; + virtual void UpdateThrobber(bool running); + virtual gfx::Size GetMinimumSize(); + + protected: + // Overridden from views::NonClientFrameView: + virtual gfx::Rect GetBoundsForClientView() const; + virtual bool AlwaysUseNativeFrame() const; + virtual gfx::Rect GetWindowBoundsForClientBounds( + const gfx::Rect& client_bounds) const; + virtual int NonClientHitTest(const gfx::Point& point); + virtual void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask); + virtual void EnableClose(bool enable); + virtual void ResetWindowControls(); + + // Overridden from views::View: + virtual void Paint(gfx::Canvas* canvas); + virtual void Layout(); + virtual bool HitTest(const gfx::Point& l) const; + virtual void ViewHierarchyChanged(bool is_add, + views::View* parent, + views::View* child); + virtual bool GetAccessibleRole(AccessibilityTypes::Role* role); + virtual bool GetAccessibleName(std::wstring* name); + virtual void SetAccessibleName(const std::wstring& name); + + // Overridden from TabIconView::TabIconViewModel: + virtual bool ShouldTabIconViewAnimate() const; + virtual SkBitmap GetFavIconForTabIconView(); + + private: + // Returns the thickness of the border that makes up the window frame edges. + // This does not include any client edge. + int FrameBorderThickness() const; + + // Returns the height of the top resize area. This is smaller than the frame + // border height in order to increase the window draggable area. + int TopResizeHeight() const; + + // Returns the thickness of the entire nonclient left, right, and bottom + // borders, including both the window frame and any client edge. + int NonClientBorderThickness() const; + + // Returns the height of the entire nonclient top border, including the window + // frame, any title area, and any connected client edge. + int NonClientTopBorderHeight() const; + + // Returns the right edge. + int RightEdge() const; + + // Paint various sub-components of this view. The *FrameBorder() functions + // also paint the background of the titlebar area, since the top frame border + // and titlebar background are a contiguous component. + void PaintMaximizedFrameBorder(gfx::Canvas* canvas); + void PaintToolbarBackground(gfx::Canvas* canvas); + + // Layout various sub-components of this view. + void LayoutClientView(); + + // Returns the bounds of the client area for the specified view size. + gfx::Rect CalculateClientAreaBounds(int width, int height) const; + + // The frame that hosts this view. + BrowserFrame* frame_; + + // The BrowserView hosted within this View. + BrowserView* browser_view_; + + // The bounds of the ClientView. + gfx::Rect client_view_bounds_; + + // The accessible name of this view. + std::wstring accessible_name_; + + DISALLOW_EVIL_CONSTRUCTORS(NormalBrowserFrameView); +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_FRAME_NORMAL_BROWSER_FRAME_VIEW_H_ diff --git a/chrome/browser/views/frame/browser_extender.cc b/chrome/browser/views/frame/browser_extender.cc deleted file mode 100644 index f0178ba..0000000 --- a/chrome/browser/views/frame/browser_extender.cc +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2009 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/views/frame/browser_extender.h" - -//////////////////////////////////////////////////////////////////////////////// -// BrowserExtender, public: - -BrowserExtender::BrowserExtender() - : can_close_(true) { -} diff --git a/chrome/browser/views/frame/browser_extender.h b/chrome/browser/views/frame/browser_extender.h index fcbc435..03c27bd 100644 --- a/chrome/browser/views/frame/browser_extender.h +++ b/chrome/browser/views/frame/browser_extender.h @@ -20,19 +20,12 @@ class BrowserView; // standard_extender.cc for Chrome browser. class BrowserExtender { public: - // Factory method to create a BrowserExtender for given - // BrowserView object. Please see the class description for details. - static BrowserExtender* Create(BrowserView* browser_view); + BrowserExtender() + : can_close_(true) { + } virtual ~BrowserExtender() {} - // Returns true if the window should be in the maximized state. - virtual bool ShouldForceMaximizedWindow() = 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; - // Tells if the browser can be closed. bool can_close() const { return can_close_; @@ -44,9 +37,6 @@ class BrowserExtender { can_close_ = b; } - protected: - BrowserExtender(); - private: // 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_frame_gtk.cc b/chrome/browser/views/frame/browser_frame_gtk.cc index f999e8e..a8a0a77 100644 --- a/chrome/browser/views/frame/browser_frame_gtk.cc +++ b/chrome/browser/views/frame/browser_frame_gtk.cc @@ -154,11 +154,6 @@ void BrowserFrameGtk::IsActiveChanged() { views::WidgetGtk::IsActiveChanged(); } -bool BrowserFrameGtk::IsMaximized() const { - return browser_view_->browser_extender()->ShouldForceMaximizedWindow() || - WindowGtk::IsMaximized(); -} - bool BrowserFrameGtk::GetAccelerator(int cmd_id, menus::Accelerator* accelerator) { return browser_view_->GetAccelerator(cmd_id, accelerator); diff --git a/chrome/browser/views/frame/browser_frame_gtk.h b/chrome/browser/views/frame/browser_frame_gtk.h index 4277b40..ed5852c 100644 --- a/chrome/browser/views/frame/browser_frame_gtk.h +++ b/chrome/browser/views/frame/browser_frame_gtk.h @@ -43,6 +43,10 @@ class BrowserFrameGtk : public BrowserFrame, virtual void IsActiveChanged(); protected: + void set_browser_frame_view(BrowserNonClientFrameView* browser_frame_view) { + browser_frame_view_ = browser_frame_view; + } + // Overridden from views::WidgetGtk: virtual views::RootView* CreateRootView(); virtual bool GetAccelerator(int cmd_id, menus::Accelerator* accelerator); @@ -52,7 +56,11 @@ class BrowserFrameGtk : public BrowserFrame, GdkEventWindowState* event); virtual gboolean OnConfigureEvent(GtkWidget* widget, GdkEventConfigure* event); - virtual bool IsMaximized() const; + + protected: + BrowserView* browser_view() const { + return browser_view_; + } private: // The BrowserView is our ClientView. This is a pointer to it. diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index ae16273..aab1ac8 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1671,7 +1671,7 @@ void BrowserView::Init() { } #endif - browser_extender_.reset(BrowserExtender::Create(this)); + browser_extender_.reset(new BrowserExtender()); } #if defined(OS_WIN) diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index 7732621..801c7b6 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -201,12 +201,16 @@ class BrowserView : public BrowserBubbleHost, return browser_->type() == Browser::TYPE_NORMAL; } + // Returns true if the Browser object associated with this BrowserView is a + // app panel window. bool IsBrowserTypePanel() const { return browser_->type() == Browser::TYPE_APP_PANEL; } + // Returns true if the Browser object associated with this BrowserView is a + // popup window. bool IsBrowserTypePopup() const { - return browser_->type() == Browser::TYPE_POPUP; + return browser_->type() & Browser::TYPE_POPUP; } // Returns true if the frame containing this BrowserView should show the diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc index ba086ee..d132420 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/views/frame/opaque_browser_frame_view.cc @@ -209,10 +209,9 @@ OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStrip( BaseTabStrip* tabstrip) const { - int x_offset = browser_view_->browser_extender()->GetMainMenuWidth(); int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? (otr_avatar_icon_->bounds().right() + kOTRSideSpacing) : - NonClientBorderThickness() + x_offset; + NonClientBorderThickness(); int tabstrip_width = minimize_button_->x() - tabstrip_x - (frame_->GetWindow()->IsMaximized() ? kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); @@ -1038,9 +1037,8 @@ void OpaqueBrowserFrameView::LayoutOTRAvatar() { visible = false; } otr_avatar_icon_->SetVisible(visible); - int x_offset = browser_view_->browser_extender()->GetMainMenuWidth(); otr_avatar_icon_->SetBounds(NonClientBorderThickness() + kOTRSideSpacing + - x_offset, + 0, top_height + tabstrip_height - otr_height, preferred_size.width(), otr_height); } diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.h b/chrome/browser/views/frame/opaque_browser_frame_view.h index 2f35726..6196da9 100644 --- a/chrome/browser/views/frame/opaque_browser_frame_view.h +++ b/chrome/browser/views/frame/opaque_browser_frame_view.h @@ -26,9 +26,7 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, public views::ButtonListener, public TabIconView::TabIconViewModel { public: - // Constructs a non-client view for an BrowserFrame. |is_otr| specifies if the - // frame was created "off-the-record" and as such different bitmaps should be - // used to render the frame. + // Constructs a non-client view for an BrowserFrame. OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); virtual ~OpaqueBrowserFrameView(); diff --git a/chrome/browser/views/frame/standard_extender.cc b/chrome/browser/views/frame/standard_extender.cc deleted file mode 100644 index ae195d9..0000000 --- a/chrome/browser/views/frame/standard_extender.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2009 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/views/frame/browser_extender.h" - -#include "chrome/browser/views/frame/browser_view.h" - -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: - StandardExtender() : BrowserExtender() { - } - virtual ~StandardExtender() {} - - private: - // BrowserExtender overrides. - virtual bool NonClientHitTest(const gfx::Point& point) { return false; } - virtual bool ShouldForceMaximizedWindow() { return false; } - virtual int GetMainMenuWidth() const { return 0; } - - DISALLOW_COPY_AND_ASSIGN(StandardExtender); -}; - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// BrowserExtender, public: - -// static -BrowserExtender* BrowserExtender::Create(BrowserView* browser_view) { - return new StandardExtender(); -} diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 3d97e3b..6a45dcb 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -305,11 +305,12 @@ 'browser/chromeos/external_metrics.h', 'browser/chromeos/external_protocol_dialog.cc', 'browser/chromeos/external_protocol_dialog.h', - 'browser/chromeos/frame/browser_extenders.cc', 'browser/chromeos/frame/browser_frame_chromeos.cc', 'browser/chromeos/frame/browser_frame_chromeos.h', 'browser/chromeos/frame/browser_view.cc', 'browser/chromeos/frame/browser_view.h', + 'browser/chromeos/frame/normal_browser_frame_view.cc', + 'browser/chromeos/frame/normal_browser_frame_view.h', 'browser/chromeos/frame/panel_browser_view.cc', 'browser/chromeos/frame/panel_browser_view.h', 'browser/chromeos/frame/panel_controller.cc', @@ -1969,7 +1970,6 @@ 'browser/views/frame/app_panel_browser_frame_view.h', 'browser/views/frame/browser_bubble_host.cc', 'browser/views/frame/browser_bubble_host.h', - 'browser/views/frame/browser_extender.cc', 'browser/views/frame/browser_extender.h', 'browser/views/frame/browser_frame.h', 'browser/views/frame/browser_frame_gtk.cc', @@ -1987,7 +1987,6 @@ 'browser/views/frame/glass_browser_frame_view.h', 'browser/views/frame/opaque_browser_frame_view.cc', 'browser/views/frame/opaque_browser_frame_view.h', - 'browser/views/frame/standard_extender.cc', 'browser/views/fullscreen_exit_bubble.cc', 'browser/views/fullscreen_exit_bubble.h', 'browser/views/go_button.cc', @@ -2531,7 +2530,6 @@ ['include', '^browser/views/frame/browser_bubble_host.h'], ['include', '^browser/views/frame/browser_view_layout.cc'], ['include', '^browser/views/frame/browser_view_layout.h'], - ['include', '^browser/views/frame/browser_extender.cc'], ['include', '^browser/views/frame/browser_extender.h'], ['include', '^browser/views/frame/browser_view.cc'], ['include', '^browser/views/frame/browser_view.h'], @@ -2687,8 +2685,6 @@ }], ['OS=="linux" and toolkit_views==1', { 'sources/': [ - ['include', '^browser/views/frame/standard_extender.h'], - ['include', '^browser/views/frame/standard_extender.cc'], ['include', '^browser/gtk/external_protocol_dialog_gtk.cc'], ['include', '^browser/gtk/external_protocol_dialog_gtk.h'], ['include', '^browser/views/notifications/balloon_view.cc'], |