summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/chrome_dll_resource.h1
-rw-r--r--chrome/app/generated_resources.grd4
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit.h3
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc1
-rw-r--r--chrome/browser/browser.cc13
-rw-r--r--chrome/browser/browser.h3
-rw-r--r--chrome/browser/browser_window.h5
-rw-r--r--chrome/browser/chromeos/chromeos_browser_extenders.cc70
-rw-r--r--chrome/browser/chromeos/compact_navigation_bar.cc67
-rw-r--r--chrome/browser/chromeos/compact_navigation_bar.h1
-rwxr-xr-xchrome/browser/chromeos/status_area_view.cc14
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.h1
-rw-r--r--chrome/browser/cocoa/location_bar_view_mac.mm3
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc3
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.h1
-rw-r--r--chrome/browser/views/accelerator_table_gtk.cc3
-rw-r--r--chrome/browser/views/frame/browser_extender.h18
-rw-r--r--chrome/browser/views/frame/browser_view.cc13
-rw-r--r--chrome/browser/views/frame/browser_view.h3
-rw-r--r--chrome/browser/views/frame/standard_extender.cc3
-rw-r--r--chrome/browser/views/location_bar_view.cc3
-rw-r--r--chrome/browser/views/location_bar_view.h1
-rw-r--r--chrome/test/test_browser_window.h4
23 files changed, 190 insertions, 48 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h
index db8c799..810968b 100644
--- a/chrome/app/chrome_dll_resource.h
+++ b/chrome/app/chrome_dll_resource.h
@@ -82,6 +82,7 @@
#define IDC_EXIT 34031
#define IDC_MOVE_TAB_NEXT 34032
#define IDC_MOVE_TAB_PREVIOUS 34033
+#define IDC_COMPACT_NAVBAR 34034
// Page-related commands
#define IDC_BOOKMARK_PAGE 35000
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 9aa5206..f4fb242 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5765,8 +5765,10 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_STATUSBAR_BATTERY_IS_CHARGED" desc="In the power menu button, the battery is charged message.">
Battery is charged
</message>
+ <message name="IDS_COMPACT_NAVBAR" desc="The menu item on the app menu to toggle compact navigation bar">
+ Toggle Compact Navigation Bar
+ </message>
</if>
-
</messages>
</release>
</grit>
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index 6a8c6d6..741b8a0 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -47,6 +47,9 @@ class AutocompleteEditController {
// the edit is guaranteed to be showing the permanent text.
virtual void OnInputInProgress(bool in_progress) = 0;
+ // Called whenever the autocomplete edit is losing focus.
+ virtual void OnKillFocus() = 0;
+
// Called whenever the autocomplete edit gets focused.
virtual void OnSetFocus() = 0;
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 310b932..e46e377 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -796,6 +796,7 @@ gboolean AutocompleteEditViewGtk::HandleViewFocusOut() {
ClosePopup();
// Tell the model to reset itself.
model_->OnKillFocus();
+ controller_->OnKillFocus();
return FALSE; // Pass the event on to the GtkTextView.
}
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 59e0df8..c68300d 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -893,6 +893,13 @@ void Browser::ToggleFullscreenMode() {
#endif
}
+#if defined(TOOLKIT_VIEWS)
+void Browser::ToggleCompactNavigationBar() {
+ UserMetrics::RecordAction(L"ToggleCompactNavigationBar", profile_);
+ window_->ToggleCompactNavigationBar();
+}
+#endif
+
void Browser::Exit() {
UserMetrics::RecordAction(L"Exit", profile_);
BrowserList::CloseAllBrowsersAndExit();
@@ -1360,6 +1367,9 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break;
case IDC_FULLSCREEN: ToggleFullscreenMode(); break;
case IDC_EXIT: Exit(); break;
+#if defined(TOOLKIT_VIEWS)
+ case IDC_COMPACT_NAVBAR: ToggleCompactNavigationBar(); break;
+#endif
// Page-related commands
case IDC_SAVE_PAGE: SavePage(); break;
@@ -2268,6 +2278,9 @@ void Browser::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true);
command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, true);
command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
+#if defined(TOOLKIT_VIEWS)
+ command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true);
+#endif
// Page-related commands
command_updater_.UpdateCommandEnabled(IDC_CLOSE_POPUPS, true);
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index a1e6f40..dc465e8 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -333,6 +333,9 @@ class Browser : public TabStripModelDelegate,
void ConvertPopupToTabbedBrowser();
void ToggleFullscreenMode();
void Exit();
+#if defined(TOOLKIT_VIEWS)
+ void ToggleCompactNavigationBar();
+#endif
// Page-related commands
void BookmarkCurrentPage();
diff --git a/chrome/browser/browser_window.h b/chrome/browser/browser_window.h
index f417166..ccbbf32 100644
--- a/chrome/browser/browser_window.h
+++ b/chrome/browser/browser_window.h
@@ -263,6 +263,11 @@ class BrowserWindow {
// keyboard event if one exists, otherwise -1.
virtual int GetCommandId(const NativeWebKeyboardEvent& event) = 0;
+#if defined(TOOLKIT_VIEWS)
+ // Toggles compact navigation bar.
+ virtual void ToggleCompactNavigationBar() = 0;
+#endif
+
// Construct a BrowserWindow implementation for the specified |browser|.
static BrowserWindow* CreateBrowserWindow(Browser* browser);
diff --git a/chrome/browser/chromeos/chromeos_browser_extenders.cc b/chrome/browser/chromeos/chromeos_browser_extenders.cc
index cf11585..fe63ec4 100644
--- a/chrome/browser/chromeos/chromeos_browser_extenders.cc
+++ b/chrome/browser/chromeos/chromeos_browser_extenders.cc
@@ -6,6 +6,7 @@
#include "app/theme_provider.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/chromeos/compact_navigation_bar.h"
#include "chrome/browser/chromeos/main_menu.h"
#include "chrome/browser/chromeos/status_area_view.h"
#include "chrome/browser/chromeos/panel_controller.h"
@@ -54,6 +55,14 @@ class NormalExtender : public BrowserExtender,
main_menu_->SetImage(views::CustomButton::BS_PUSHED, image);
browser_view()->AddChildView(main_menu_);
+ compact_navigation_bar_ =
+ new CompactNavigationBar(browser_view()->browser());
+ browser_view()->AddChildView(compact_navigation_bar_);
+ compact_navigation_bar_->Init();
+ // Disabled by default.
+ // TODO(oshima): Get this info from preference.
+ compact_navigation_bar_->SetVisible(false);
+
status_area_ = new StatusAreaView(
browser_view()->browser(),
browser_view()->GetWindow()->GetNativeWindow());
@@ -87,35 +96,64 @@ class NormalExtender : public BrowserExtender,
status_area_->SetBounds(bounds.x() + bounds.width() - status_size.width(),
bounds.y(), status_size.width(),
status_size.height());
+ int curx = bounds.x() + main_menu_size.width();
int width = bounds.width() - main_menu_size.width() - status_size.width();
- return gfx::Rect(bounds.x() + main_menu_size.width(),
- bounds.y(),
- std::max(0, width), // in case there is no space left.
- bounds.height());
+
+ if (compact_navigation_bar_->IsVisible()) {
+ gfx::Size cnb_bounds = compact_navigation_bar_->GetPreferredSize();
+ compact_navigation_bar_->SetBounds(curx, bounds.y(),
+ cnb_bounds.width(), bounds.height());
+ curx += cnb_bounds.width();
+ width -= cnb_bounds.width();
+ }
+ width = std::max(0, width); // In case there is no space left.
+ return gfx::Rect(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);
-
- return main_menu_->HitTest(point_in_main_menu_coords) ||
- status_area_->HitTest(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 void UpdateTitleBar() {}
+
virtual void Show() {
- // TODO(oshima): PanelController seems to be doing something similar.
- // Investigate if we need both.
TabOverviewTypes::instance()->SetWindowType(
GTK_WIDGET(GetBrowserWindow()->GetNativeWindow()),
TabOverviewTypes::WINDOW_TYPE_CHROME_TOPLEVEL,
NULL);
}
+ virtual void Close() {}
+
+ virtual void ActivationChanged() {}
+
+ virtual bool ShouldForceHideToolbar() {
+ return compact_navigation_bar_->IsVisible();
+ }
+
+ virtual void ToggleCompactNavigationBar() {
+ compact_navigation_bar_->SetVisible(!compact_navigation_bar_->IsVisible());
+ }
+
private:
// Creates system menu.
void InitSystemMenu() {
@@ -152,6 +190,9 @@ class NormalExtender : public BrowserExtender,
scoped_ptr<views::SimpleMenuModel> system_menu_contents_;
scoped_ptr<views::Menu2> system_menu_menu_;
+ // CompactNavigationBar view.
+ CompactNavigationBar* compact_navigation_bar_;
+
DISALLOW_COPY_AND_ASSIGN(NormalExtender);
};
@@ -183,6 +224,10 @@ class PopupExtender : public BrowserExtender {
gtk_window_resize(native_window, bounds.width(), bounds.height());
}
+ virtual gfx::Rect Layout(const gfx::Rect& bounds) {
+ return bounds;
+ }
+
virtual bool NonClientHitTest(const gfx::Point& point) {
return false;
}
@@ -210,6 +255,13 @@ class PopupExtender : public BrowserExtender {
}
}
+ virtual bool ShouldForceHideToolbar() {
+ // Always hide toolbar for popups.
+ return true;
+ }
+
+ virtual void ToggleCompactNavigationBar() {}
+
// Controls interactions with the window manager for popup panels.
scoped_ptr<PanelController> panel_controller_;
diff --git a/chrome/browser/chromeos/compact_navigation_bar.cc b/chrome/browser/chromeos/compact_navigation_bar.cc
index d8859ee..b316095 100644
--- a/chrome/browser/chromeos/compact_navigation_bar.cc
+++ b/chrome/browser/chromeos/compact_navigation_bar.cc
@@ -40,7 +40,8 @@ CompactNavigationBar::CompactNavigationBar(Browser* browser)
}
CompactNavigationBar::~CompactNavigationBar() {
- location_entry_view_->Detach();
+ if (location_entry_view_->native_view())
+ location_entry_view_->Detach();
}
void CompactNavigationBar::Init() {
@@ -100,27 +101,36 @@ void CompactNavigationBar::Layout() {
if (!initialized_)
return;
- int curx = 0;
-
- // "Back | Forward" section.
- gfx::Size button_size = back_button_->GetPreferredSize();
- button_size.set_width(button_size.width() + kInnerPadding * 2);
- back_button_->SetBounds(curx, 0, button_size.width(), height());
- curx += button_size.width() + kHorizPadding;
-
- button_size = bf_separator_->GetPreferredSize();
- bf_separator_->SetBounds(curx, 0, button_size.width(), height());
- curx += button_size.width() + kHorizPadding;
-
- button_size = forward_button_->GetPreferredSize();
- button_size.set_width(button_size.width() + kInnerPadding * 2);
- forward_button_->SetBounds(curx, 0, button_size.width(), height());
- curx += button_size.width() + kHorizPadding;
-
- // URL bar.
- location_entry_view_->SetBounds(curx + kURLPadding, 0,
- kURLWidth + kURLPadding * 2, height());
- curx += kURLWidth + kHorizPadding + kURLPadding * 2;
+ // We hide navigation buttons when the entry has focus. Navigation
+ // buttons' visibility is controlled in OnKillFocus/OnSetFocus methods.
+ if (!back_button_->IsVisible()) {
+ // Fill the view with the entry view while it has focus.
+ location_entry_view_->SetBounds(kURLPadding, 0,
+ width() - kHorizPadding, height());
+ } else {
+ // Layout forward/back buttons after entry views as follows:
+ // [Entry View] [Back]|[Forward]
+ int curx = 0;
+ // URL bar.
+ location_entry_view_->SetBounds(curx + kURLPadding, 0,
+ kURLWidth + kURLPadding * 2, height());
+ curx += kURLWidth + kHorizPadding + kURLPadding * 2;
+
+ // "Back | Forward" section.
+ gfx::Size button_size = back_button_->GetPreferredSize();
+ button_size.set_width(button_size.width() + kInnerPadding * 2);
+ back_button_->SetBounds(curx, 0, button_size.width(), height());
+ curx += button_size.width() + kHorizPadding;
+
+ button_size = bf_separator_->GetPreferredSize();
+ bf_separator_->SetBounds(curx, 0, button_size.width(), height());
+ curx += button_size.width() + kHorizPadding;
+
+ button_size = forward_button_->GetPreferredSize();
+ button_size.set_width(button_size.width() + kInnerPadding * 2);
+ forward_button_->SetBounds(curx, 0, button_size.width(), height());
+ curx += button_size.width() + kHorizPadding;
+ }
}
void CompactNavigationBar::Paint(gfx::Canvas* canvas) {
@@ -180,7 +190,20 @@ void CompactNavigationBar::OnChanged() {
void CompactNavigationBar::OnInputInProgress(bool in_progress) {
}
+void CompactNavigationBar::OnKillFocus() {
+ back_button_->SetVisible(true);
+ bf_separator_->SetVisible(true);
+ forward_button_->SetVisible(true);
+ Layout();
+ SchedulePaint();
+}
+
void CompactNavigationBar::OnSetFocus() {
+ back_button_->SetVisible(false);
+ bf_separator_->SetVisible(false);
+ forward_button_->SetVisible(false);
+ Layout();
+ SchedulePaint();
}
SkBitmap CompactNavigationBar::GetFavIcon() const {
diff --git a/chrome/browser/chromeos/compact_navigation_bar.h b/chrome/browser/chromeos/compact_navigation_bar.h
index d5e4961..dec7c1d 100644
--- a/chrome/browser/chromeos/compact_navigation_bar.h
+++ b/chrome/browser/chromeos/compact_navigation_bar.h
@@ -51,6 +51,7 @@ class CompactNavigationBar : public views::View,
const GURL& alternate_nav_url);
virtual void OnChanged();
virtual void OnInputInProgress(bool in_progress);
+ virtual void OnKillFocus();
virtual void OnSetFocus();
virtual SkBitmap GetFavIcon() const;
virtual std::wstring GetTitle() const;
diff --git a/chrome/browser/chromeos/status_area_view.cc b/chrome/browser/chromeos/status_area_view.cc
index 5b268dd..62bcd68 100755
--- a/chrome/browser/chromeos/status_area_view.cc
+++ b/chrome/browser/chromeos/status_area_view.cc
@@ -50,9 +50,12 @@ class OptionsMenuModel : public views::SimpleMenuModel,
views::SimpleMenuModel::Delegate* delegate)
: SimpleMenuModel(this),
browser_(browser) {
+#if defined(TOOLKIT_VIEWS)
+ AddItemWithStringId(IDC_COMPACT_NAVBAR, IDS_COMPACT_NAVBAR);
+#else
AddItem(static_cast<int>(CREATE_NEW_WINDOW),
ASCIIToUTF16("New window"));
-
+#endif
AddSeparator();
AddItem(static_cast<int>(StatusAreaView::OPEN_TABS_ON_LEFT),
@@ -79,11 +82,12 @@ class OptionsMenuModel : public views::SimpleMenuModel,
}
virtual void ExecuteCommand(int command_id) {
switch (command_id) {
- case CREATE_NEW_WINDOW:
#if defined(TOOLKIT_VIEWS)
- // TODO(oshima): Implement accelerator to enable/disable
- // compact nav bar.
+ case IDC_COMPACT_NAVBAR:
+ browser_->ExecuteCommand(command_id);
+ break;
#else
+ case CREATE_NEW_WINDOW:
// Reach into the GTK browser window and enable the flag to create the
// next window as a compact nav one.
// TODO(brettw) this is an evil hack, and is here so this can be tested.
@@ -91,8 +95,8 @@ class OptionsMenuModel : public views::SimpleMenuModel,
static_cast<BrowserWindowGtk*>(browser_->window())->
set_next_window_should_use_compact_nav();
browser_->ExecuteCommand(IDC_NEW_WINDOW);
-#endif
break;
+#endif
case StatusAreaView::OPEN_TABS_ON_LEFT:
case StatusAreaView::OPEN_TABS_CLOBBER:
case StatusAreaView::OPEN_TABS_ON_RIGHT:
diff --git a/chrome/browser/cocoa/location_bar_view_mac.h b/chrome/browser/cocoa/location_bar_view_mac.h
index e305544..fb08b3f 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.h
+++ b/chrome/browser/cocoa/location_bar_view_mac.h
@@ -68,6 +68,7 @@ class LocationBarViewMac : public AutocompleteEditController,
const GURL& alternate_nav_url);
virtual void OnChanged();
virtual void OnInputInProgress(bool in_progress);
+ virtual void OnKillFocus();
virtual void OnSetFocus();
virtual SkBitmap GetFavIcon() const;
virtual std::wstring GetTitle() const;
diff --git a/chrome/browser/cocoa/location_bar_view_mac.mm b/chrome/browser/cocoa/location_bar_view_mac.mm
index a4d2e64..2e935cc 100644
--- a/chrome/browser/cocoa/location_bar_view_mac.mm
+++ b/chrome/browser/cocoa/location_bar_view_mac.mm
@@ -265,6 +265,9 @@ void LocationBarViewMac::OnInputInProgress(bool in_progress) {
Update(NULL, false);
}
+void LocationBarViewMac::OnKillFocus() {
+}
+
void LocationBarViewMac::OnSetFocus() {
}
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 8aec081..38c24c0 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -350,6 +350,9 @@ void LocationBarViewGtk::OnInputInProgress(bool in_progress) {
Update(NULL);
}
+void LocationBarViewGtk::OnKillFocus() {
+}
+
void LocationBarViewGtk::OnSetFocus() {
}
diff --git a/chrome/browser/gtk/location_bar_view_gtk.h b/chrome/browser/gtk/location_bar_view_gtk.h
index 82f9b1e..bedf724 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.h
+++ b/chrome/browser/gtk/location_bar_view_gtk.h
@@ -63,6 +63,7 @@ class LocationBarViewGtk : public AutocompleteEditController,
PageTransition::Type transition,
const GURL& alternate_nav_url);
virtual void OnChanged();
+ virtual void OnKillFocus();
virtual void OnSetFocus();
virtual void OnInputInProgress(bool in_progress);
virtual SkBitmap GetFavIcon() const;
diff --git a/chrome/browser/views/accelerator_table_gtk.cc b/chrome/browser/views/accelerator_table_gtk.cc
index 25fbac7..e6fd122 100644
--- a/chrome/browser/views/accelerator_table_gtk.cc
+++ b/chrome/browser/views/accelerator_table_gtk.cc
@@ -11,6 +11,8 @@
namespace browser {
const AcceleratorMapping kAcceleratorMap[] = {
+ // Format { keycode, shift_pressed, ctrl_pressed, alt_pressed, command_id }
+
// Focus.
{ base::VKEY_K, false, true, false, IDC_FOCUS_SEARCH },
{ base::VKEY_E, false, true, false, IDC_FOCUS_SEARCH },
@@ -114,6 +116,7 @@ const AcceleratorMapping kAcceleratorMap[] = {
{ base::VKEY_B, true, true, false, IDC_SHOW_BOOKMARK_MANAGER },
{ base::VKEY_F1, false, false, false, IDC_HELP_PAGE },
{ base::VKEY_Q, true, true, false, IDC_EXIT },
+ { base::VKEY_0, true, true, false, IDC_COMPACT_NAVBAR},
};
const size_t kAcceleratorMapLength = arraysize(kAcceleratorMap);
diff --git a/chrome/browser/views/frame/browser_extender.h b/chrome/browser/views/frame/browser_extender.h
index 6481d11..094bd2d 100644
--- a/chrome/browser/views/frame/browser_extender.h
+++ b/chrome/browser/views/frame/browser_extender.h
@@ -18,7 +18,7 @@ class Window;
// 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.
-// Please see chromeos_browser_extender.cc for ChromeOS extenders, and
+// Please see chromeos_browser_extenders.cc for ChromeOS extenders, and
// standard_extender.cc for Chrome browser.
class BrowserExtender {
public:
@@ -33,23 +33,30 @@ class BrowserExtender {
// Layouts controls within the given bounds and returns the remaining
// bounds for tabstip to be layed out.
- virtual gfx::Rect Layout(const gfx::Rect& bounds) { return bounds; }
+ virtual gfx::Rect Layout(const gfx::Rect& bounds) = 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;
// Updates the title bar (if any).
- virtual void UpdateTitleBar() {}
+ virtual void UpdateTitleBar() = 0;
// Called when the BrowserView is shown.
virtual void Show() = 0;
// Called when the BrowserView is closed.
- virtual void Close() {}
+ virtual void Close() = 0;
// Called when the browser window is either activated or deactivated.
- virtual void ActivationChanged() {}
+ virtual void ActivationChanged() = 0;
+
+ // Returns true to hide the toolbar for the window, or false
+ // to use the regular logic to decide.
+ virtual bool ShouldForceHideToolbar() = 0;
+
+ // Toggles the visibility of CompactNavigationBar.
+ virtual void ToggleCompactNavigationBar() = 0;
// Tells if the browser can be closed.
bool can_close() const {
@@ -83,4 +90,3 @@ class BrowserExtender {
};
#endif // CHROME_BROWSER_CHROMEOS_BROWSER_EXTENDER_H_
-
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index 8fb342a9..cb28200 100644
--- a/chrome/browser/views/frame/browser_view.cc
+++ b/chrome/browser/views/frame/browser_view.cc
@@ -568,12 +568,8 @@ gfx::Rect BrowserView::GetTabStripBounds() const {
}
bool BrowserView::IsToolbarVisible() const {
-#if defined(OS_CHROMEOS)
- if (browser_->type() & Browser::TYPE_POPUP) {
- // Don't show toolbar if the window is a popup.
+ if (browser_extender_->ShouldForceHideToolbar())
return false;
- }
-#endif
return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
}
@@ -1199,6 +1195,13 @@ int BrowserView::GetCommandId(const NativeWebKeyboardEvent& event) {
return iter->second;
}
+#if defined(TOOLKIT_VIEWS)
+void BrowserView::ToggleCompactNavigationBar() {
+ browser_extender_->ToggleCompactNavigationBar();
+ Layout();
+}
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// BrowserView, BrowserWindowTesting implementation:
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 42967af..5aa5c3c 100644
--- a/chrome/browser/views/frame/browser_view.h
+++ b/chrome/browser/views/frame/browser_view.h
@@ -271,6 +271,9 @@ class BrowserView : public BrowserWindow,
virtual void ShowAppMenu();
virtual void ShowPageMenu();
virtual int GetCommandId(const NativeWebKeyboardEvent& event);
+#if defined(TOOLKIT_VIEWS)
+ virtual void ToggleCompactNavigationBar();
+#endif
// Overridden from BrowserWindowTesting:
virtual BookmarkBarView* GetBookmarkBarView() const;
diff --git a/chrome/browser/views/frame/standard_extender.cc b/chrome/browser/views/frame/standard_extender.cc
index 3f32fa6..c7370b8 100644
--- a/chrome/browser/views/frame/standard_extender.cc
+++ b/chrome/browser/views/frame/standard_extender.cc
@@ -18,11 +18,14 @@ class StandardExtender : public BrowserExtender {
private:
// BrowserExtender overrides.
virtual void Init() {}
+ virtual gfx::Rect Layout(const gfx::Rect& bounds) { return bounds; }
virtual bool NonClientHitTest(const gfx::Point& point) { return false; }
virtual void Show() {}
virtual void Close() {}
virtual void UpdateTitleBar() {}
virtual void ActivationChanged() {}
+ virtual bool ShouldForceHideToolbar() { return false; }
+ virtual void ToggleCompactNavigationBar() {}
DISALLOW_COPY_AND_ASSIGN(StandardExtender);
};
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 3793d52..95d2915 100644
--- a/chrome/browser/views/location_bar_view.cc
+++ b/chrome/browser/views/location_bar_view.cc
@@ -443,6 +443,9 @@ void LocationBarView::OnChanged() {
DoLayout(false);
}
+void LocationBarView::OnKillFocus() {
+}
+
void LocationBarView::OnSetFocus() {
views::FocusManager* focus_manager = GetFocusManager();
if (!focus_manager) {
diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h
index f725057..5c40886 100644
--- a/chrome/browser/views/location_bar_view.h
+++ b/chrome/browser/views/location_bar_view.h
@@ -125,6 +125,7 @@ class LocationBarView : public LocationBar,
virtual void OnInputInProgress(bool in_progress) {
delegate_->OnInputInProgress(in_progress);
}
+ virtual void OnKillFocus();
virtual void OnSetFocus();
virtual SkBitmap GetFavIcon() const;
virtual std::wstring GetTitle() const;
diff --git a/chrome/test/test_browser_window.h b/chrome/test/test_browser_window.h
index d785415..e667746 100644
--- a/chrome/test/test_browser_window.h
+++ b/chrome/test/test_browser_window.h
@@ -50,6 +50,10 @@ class TestBrowserWindow : public BrowserWindow {
virtual void ShowPageMenu() {}
virtual void ShowAppMenu() {}
virtual int GetCommandId(const NativeWebKeyboardEvent& event) { return -1; }
+#if defined(TOOLKIT_VIEWS)
+ virtual void ToggleCompactNavigationBar() {}
+#endif
+
virtual bool IsBookmarkBarVisible() const { return false; }
virtual gfx::Rect GetRootWindowResizerRect() const { return gfx::Rect(); }
virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,