summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser.cc
diff options
context:
space:
mode:
authorstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 13:26:05 +0000
committerstevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-11 13:26:05 +0000
commitac86c98e2ff5c93c62b54392e975afec381a2855 (patch)
tree277726a3b4234864493eead0663f5be6a8c387f4 /chrome/browser/ui/browser.cc
parent659a95bf640de07acaa34a341033d581e4db0bd2 (diff)
downloadchromium_src-ac86c98e2ff5c93c62b54392e975afec381a2855.zip
chromium_src-ac86c98e2ff5c93c62b54392e975afec381a2855.tar.gz
chromium_src-ac86c98e2ff5c93c62b54392e975afec381a2855.tar.bz2
The initial prototype code for the compact navigation (cnav) prototype, currently only active in windows. This is well hidden behind a flag and a context menu option.
Loosely based off oshima's original prototype patch: http://codereview.chromium.org/165272 BUG=None TEST=Activate the cnav prototype in about:flags. Right click a tab and select "Hide Toolbar" to go into cnav mode. Ensure that the compact location bar provides the same basic functionality as the toolbar (except browser actions). Review URL: http://codereview.chromium.org/6913026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser.cc')
-rw-r--r--chrome/browser/ui/browser.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 74acb11..ab07046 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -264,12 +264,22 @@ Browser::Browser(Type type, Profile* profile)
encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
profile_->GetPrefs(), NULL);
use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this);
+ use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar,
+ profile_->GetPrefs(),
+ this);
if (!TabMenuModel::AreVerticalTabsEnabled()) {
// If vertical tabs aren't enabled, explicitly turn them off. Otherwise we
// might show vertical tabs but not show an option to turn them off.
use_vertical_tabs_.SetValue(false);
}
+ if (!TabMenuModel::IsCompactNavigationModeEnabled()) {
+ // If the compact navigation bar isn't enabled, explicitly turn it off.
+ // Otherwise we might show the compact navigation bar but not show an option
+ // to turn it off.
+ use_compact_navigation_bar_.SetValue(false);
+ }
+
UpdateTabStripModelInsertionPolicy();
tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile);
@@ -328,6 +338,7 @@ Browser::~Browser() {
encoding_auto_detect_.Destroy();
use_vertical_tabs_.Destroy();
+ use_compact_navigation_bar_.Destroy();
if (profile_->IsOffTheRecord() &&
!BrowserList::IsOffTheRecordSessionActive()) {
@@ -427,6 +438,11 @@ void Browser::InitBrowserWindow() {
Source<Browser>(this),
NotificationService::NoDetails());
+ if (use_compact_navigation_bar_.GetValue()) {
+ // This enables the compact navigation bar host.
+ UseCompactNavigationBarChanged();
+ }
+
// Show the First Run information bubble if we've been told to.
PrefService* local_state = g_browser_process->local_state();
if (!local_state)
@@ -1216,6 +1232,7 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui);
+ command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, show_main_ui);
#if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC)
command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui);
#endif
@@ -1253,6 +1270,10 @@ void Browser::UseVerticalTabsChanged() {
window()->ToggleTabStripMode();
}
+void Browser::UseCompactNavigationBarChanged() {
+ window_->ToggleUseCompactNavigationBar();
+}
+
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
bool check_fullscreen) const {
// On Mac, fullscreen mode has most normal things (in a slide-down panel). On
@@ -2150,6 +2171,9 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterBooleanPref(prefs::kUseVerticalTabs,
false,
PrefService::UNSYNCABLE_PREF);
+ prefs->RegisterBooleanPref(prefs::kUseCompactNavigationBar,
+ false,
+ PrefService::UNSYNCABLE_PREF);
prefs->RegisterBooleanPref(prefs::kEnableTranslate,
true,
PrefService::SYNCABLE_PREF);
@@ -2299,6 +2323,7 @@ void Browser::ExecuteCommandWithDisposition(
case IDC_FULLSCREEN: ToggleFullscreenMode(); break;
case IDC_EXIT: Exit(); break;
case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break;
+ case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break;
#if defined(OS_CHROMEOS)
case IDC_SEARCH: Search(); break;
case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break;
@@ -2774,6 +2799,11 @@ void Browser::ToggleUseVerticalTabs() {
UseVerticalTabsChanged();
}
+void Browser::ToggleUseCompactNavigationBar() {
+ use_compact_navigation_bar_.SetValue(!UseCompactNavigationBar());
+ UseCompactNavigationBarChanged();
+}
+
bool Browser::LargeIconsPermitted() const {
// We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because
// for those windows, we already have a big icon in the top-left outside any
@@ -3158,6 +3188,10 @@ bool Browser::UseVerticalTabs() const {
return use_vertical_tabs_.GetValue();
}
+bool Browser::UseCompactNavigationBar() const {
+ return use_compact_navigation_bar_.GetValue();
+}
+
void Browser::ContentsZoomChange(bool zoom_in) {
ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS);
}
@@ -3555,6 +3589,8 @@ void Browser::Observe(NotificationType type,
const std::string& pref_name = *Details<std::string>(details).ptr();
if (pref_name == prefs::kUseVerticalTabs) {
UseVerticalTabsChanged();
+ } else if (pref_name == prefs::kUseCompactNavigationBar) {
+ UseCompactNavigationBarChanged();
} else if (pref_name == prefs::kPrintingEnabled) {
UpdatePrintingState(GetContentRestrictionsForSelectedTab());
} else if (pref_name == prefs::kInstantEnabled) {