Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); | 247 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); |
| 248 | 248 |
| 249 InitCommandState(); | 249 InitCommandState(); |
| 250 BrowserList::AddBrowser(this); | 250 BrowserList::AddBrowser(this); |
| 251 | 251 |
| 252 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 252 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
| 253 // or you'll get a nasty surprise when you run the incognito tests. | 253 // or you'll get a nasty surprise when you run the incognito tests. |
| 254 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 254 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 255 profile_->GetPrefs(), NULL); | 255 profile_->GetPrefs(), NULL); |
| 256 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); | 256 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); |
| 257 use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar, | |
| 258 profile_->GetPrefs(), | |
| 259 this); | |
| 257 | 260 |
| 258 if (!TabMenuModel::AreVerticalTabsEnabled()) { | 261 if (!TabMenuModel::AreVerticalTabsEnabled()) { |
| 259 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we | 262 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we |
| 260 // might show vertical tabs but not show an option to turn them off. | 263 // might show vertical tabs but not show an option to turn them off. |
| 261 use_vertical_tabs_.SetValue(false); | 264 use_vertical_tabs_.SetValue(false); |
| 262 } | 265 } |
| 266 if (!TabMenuModel::IsCompactNavigationBarEnabled()) { | |
| 267 // If the compact navigation bar isn't enabled, explicitly turn it off. | |
| 268 // Otherwise we might show the compact navigation bar but not show an option | |
| 269 // to turn it off. | |
| 270 use_compact_navigation_bar_.SetValue(false); | |
| 271 } | |
| 272 | |
| 263 UpdateTabStripModelInsertionPolicy(); | 273 UpdateTabStripModelInsertionPolicy(); |
| 264 | 274 |
| 265 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); | 275 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); |
| 266 if (tab_restore_service_) { | 276 if (tab_restore_service_) { |
| 267 tab_restore_service_->AddObserver(this); | 277 tab_restore_service_->AddObserver(this); |
| 268 TabRestoreServiceChanged(tab_restore_service_); | 278 TabRestoreServiceChanged(tab_restore_service_); |
| 269 } | 279 } |
| 270 | 280 |
| 271 if (profile_->GetProfileSyncService()) | 281 if (profile_->GetProfileSyncService()) |
| 272 profile_->GetProfileSyncService()->AddObserver(this); | 282 profile_->GetProfileSyncService()->AddObserver(this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 TabRestoreService* tab_restore_service = | 321 TabRestoreService* tab_restore_service = |
| 312 TabRestoreServiceFactory::GetForProfile(profile()); | 322 TabRestoreServiceFactory::GetForProfile(profile()); |
| 313 if (tab_restore_service) | 323 if (tab_restore_service) |
| 314 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); | 324 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); |
| 315 | 325 |
| 316 profile_pref_registrar_.RemoveAll(); | 326 profile_pref_registrar_.RemoveAll(); |
| 317 local_pref_registrar_.RemoveAll(); | 327 local_pref_registrar_.RemoveAll(); |
| 318 | 328 |
| 319 encoding_auto_detect_.Destroy(); | 329 encoding_auto_detect_.Destroy(); |
| 320 use_vertical_tabs_.Destroy(); | 330 use_vertical_tabs_.Destroy(); |
| 331 use_compact_navigation_bar_.Destroy(); | |
| 321 | 332 |
| 322 if (profile_->IsOffTheRecord() && | 333 if (profile_->IsOffTheRecord() && |
| 323 !BrowserList::IsOffTheRecordSessionActive()) { | 334 !BrowserList::IsOffTheRecordSessionActive()) { |
| 324 // An incognito profile is no longer needed, this indirectly | 335 // An incognito profile is no longer needed, this indirectly |
| 325 // frees its cache and cookies. | 336 // frees its cache and cookies. |
| 326 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); | 337 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); |
| 327 } | 338 } |
| 328 | 339 |
| 329 // There may be pending file dialogs, we need to tell them that we've gone | 340 // There may be pending file dialogs, we need to tell them that we've gone |
| 330 // away so they don't try and call back to us. | 341 // away so they don't try and call back to us. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 ShellIntegration::GetChromiumAppId(profile_->GetPath()), | 416 ShellIntegration::GetChromiumAppId(profile_->GetPath()), |
| 406 window()->GetNativeHandle()); | 417 window()->GetNativeHandle()); |
| 407 } | 418 } |
| 408 #endif | 419 #endif |
| 409 | 420 |
| 410 NotificationService::current()->Notify( | 421 NotificationService::current()->Notify( |
| 411 NotificationType::BROWSER_WINDOW_READY, | 422 NotificationType::BROWSER_WINDOW_READY, |
| 412 Source<Browser>(this), | 423 Source<Browser>(this), |
| 413 NotificationService::NoDetails()); | 424 NotificationService::NoDetails()); |
| 414 | 425 |
| 426 if (use_compact_navigation_bar_.GetValue()) { | |
| 427 // This enables the compact navigation bar host. | |
| 428 UseCompactNavigationBarChanged(); | |
| 429 } | |
| 430 | |
| 415 // Show the First Run information bubble if we've been told to. | 431 // Show the First Run information bubble if we've been told to. |
| 416 PrefService* local_state = g_browser_process->local_state(); | 432 PrefService* local_state = g_browser_process->local_state(); |
| 417 if (!local_state) | 433 if (!local_state) |
| 418 return; | 434 return; |
| 419 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && | 435 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && |
| 420 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 436 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 421 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; | 437 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; |
| 422 if (local_state-> | 438 if (local_state-> |
| 423 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && | 439 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && |
| 424 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { | 440 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 1194 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
| 1179 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 1195 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, |
| 1180 show_main_ui && profile_->IsSyncAccessible()); | 1196 show_main_ui && profile_->IsSyncAccessible()); |
| 1181 | 1197 |
| 1182 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 1198 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
| 1183 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 1199 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
| 1184 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 1200 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
| 1185 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 1201 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
| 1186 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); | 1202 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); |
| 1187 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); | 1203 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); |
| 1204 command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, true); | |
|
sky
2011/05/03 18:38:32
If IDC_COMPACT_NAVBAR is always enabled, then it s
SteveT
2011/05/06 18:48:43
Sorry - used to be true for everyone but changed t
| |
| 1188 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) | 1205 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) |
| 1189 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); | 1206 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); |
| 1190 #endif | 1207 #endif |
| 1191 } | 1208 } |
| 1192 | 1209 |
| 1193 /////////////////////////////////////////////////////////////////////////////// | 1210 /////////////////////////////////////////////////////////////////////////////// |
| 1194 // Browser, Assorted browser commands: | 1211 // Browser, Assorted browser commands: |
| 1195 | 1212 |
| 1196 bool Browser::ShouldOpenNewTabForWindowDisposition( | 1213 bool Browser::ShouldOpenNewTabForWindowDisposition( |
| 1197 WindowOpenDisposition disposition) { | 1214 WindowOpenDisposition disposition) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1215 void Browser::UpdateTabStripModelInsertionPolicy() { | 1232 void Browser::UpdateTabStripModelInsertionPolicy() { |
| 1216 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? | 1233 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? |
| 1217 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); | 1234 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); |
| 1218 } | 1235 } |
| 1219 | 1236 |
| 1220 void Browser::UseVerticalTabsChanged() { | 1237 void Browser::UseVerticalTabsChanged() { |
| 1221 UpdateTabStripModelInsertionPolicy(); | 1238 UpdateTabStripModelInsertionPolicy(); |
| 1222 window()->ToggleTabStripMode(); | 1239 window()->ToggleTabStripMode(); |
| 1223 } | 1240 } |
| 1224 | 1241 |
| 1242 void Browser::UseCompactNavigationBarChanged() { | |
| 1243 window_->ToggleUseCompactNavigationBar(); | |
| 1244 } | |
| 1245 | |
| 1225 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, | 1246 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, |
| 1226 bool check_fullscreen) const { | 1247 bool check_fullscreen) const { |
| 1227 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 1248 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
| 1228 // other platforms, we hide some controls when in fullscreen mode. | 1249 // other platforms, we hide some controls when in fullscreen mode. |
| 1229 bool hide_ui_for_fullscreen = false; | 1250 bool hide_ui_for_fullscreen = false; |
| 1230 #if !defined(OS_MACOSX) | 1251 #if !defined(OS_MACOSX) |
| 1231 hide_ui_for_fullscreen = check_fullscreen && window_ && | 1252 hide_ui_for_fullscreen = check_fullscreen && window_ && |
| 1232 window_->IsFullscreen(); | 1253 window_->IsFullscreen(); |
| 1233 #endif | 1254 #endif |
| 1234 | 1255 |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2080 prefs->RegisterBooleanPref(prefs::kDeleteCookies, true); | 2101 prefs->RegisterBooleanPref(prefs::kDeleteCookies, true); |
| 2081 prefs->RegisterBooleanPref(prefs::kDeletePasswords, false); | 2102 prefs->RegisterBooleanPref(prefs::kDeletePasswords, false); |
| 2082 prefs->RegisterBooleanPref(prefs::kDeleteFormData, false); | 2103 prefs->RegisterBooleanPref(prefs::kDeleteFormData, false); |
| 2083 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); | 2104 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); |
| 2084 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); | 2105 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); |
| 2085 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); | 2106 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); |
| 2086 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); | 2107 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); |
| 2087 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); | 2108 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); |
| 2088 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); | 2109 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); |
| 2089 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); | 2110 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); |
| 2111 prefs->RegisterBooleanPref(prefs::kUseCompactNavigationBar, false); | |
| 2090 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); | 2112 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); |
| 2091 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, true); | 2113 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, true); |
| 2092 prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); | 2114 prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); |
| 2093 prefs->RegisterBooleanPref(prefs::kChromotingEnabled, false); | 2115 prefs->RegisterBooleanPref(prefs::kChromotingEnabled, false); |
| 2094 prefs->RegisterBooleanPref(prefs::kChromotingHostEnabled, false); | 2116 prefs->RegisterBooleanPref(prefs::kChromotingHostEnabled, false); |
| 2095 prefs->RegisterBooleanPref(prefs::kChromotingHostFirewallTraversal, false); | 2117 prefs->RegisterBooleanPref(prefs::kChromotingHostFirewallTraversal, false); |
| 2096 prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); | 2118 prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); |
| 2097 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true); | 2119 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true); |
| 2098 prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); | 2120 prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); |
| 2099 prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); | 2121 prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2202 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); | 2224 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); |
| 2203 break; | 2225 break; |
| 2204 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 2226 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
| 2205 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 2227 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
| 2206 case IDC_RESTORE_TAB: RestoreTab(); break; | 2228 case IDC_RESTORE_TAB: RestoreTab(); break; |
| 2207 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 2229 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
| 2208 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 2230 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
| 2209 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 2231 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
| 2210 case IDC_EXIT: Exit(); break; | 2232 case IDC_EXIT: Exit(); break; |
| 2211 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; | 2233 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; |
| 2234 case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break; | |
| 2212 #if defined(OS_CHROMEOS) | 2235 #if defined(OS_CHROMEOS) |
| 2213 case IDC_SEARCH: Search(); break; | 2236 case IDC_SEARCH: Search(); break; |
| 2214 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; | 2237 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; |
| 2215 #endif | 2238 #endif |
| 2216 | 2239 |
| 2217 // Page-related commands | 2240 // Page-related commands |
| 2218 case IDC_SAVE_PAGE: SavePage(); break; | 2241 case IDC_SAVE_PAGE: SavePage(); break; |
| 2219 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; | 2242 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; |
| 2220 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; | 2243 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; |
| 2221 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; | 2244 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2677 TabCloseableStateWatcher* watcher = | 2700 TabCloseableStateWatcher* watcher = |
| 2678 g_browser_process->tab_closeable_state_watcher(); | 2701 g_browser_process->tab_closeable_state_watcher(); |
| 2679 return !watcher || watcher->CanCloseTab(this); | 2702 return !watcher || watcher->CanCloseTab(this); |
| 2680 } | 2703 } |
| 2681 | 2704 |
| 2682 void Browser::ToggleUseVerticalTabs() { | 2705 void Browser::ToggleUseVerticalTabs() { |
| 2683 use_vertical_tabs_.SetValue(!UseVerticalTabs()); | 2706 use_vertical_tabs_.SetValue(!UseVerticalTabs()); |
| 2684 UseVerticalTabsChanged(); | 2707 UseVerticalTabsChanged(); |
| 2685 } | 2708 } |
| 2686 | 2709 |
| 2710 void Browser::ToggleUseCompactNavigationBar() { | |
| 2711 use_compact_navigation_bar_.SetValue(!UseCompactNavigationBar()); | |
| 2712 UseCompactNavigationBarChanged(); | |
| 2713 } | |
| 2714 | |
| 2687 bool Browser::LargeIconsPermitted() const { | 2715 bool Browser::LargeIconsPermitted() const { |
| 2688 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because | 2716 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because |
| 2689 // for those windows, we already have a big icon in the top-left outside any | 2717 // for those windows, we already have a big icon in the top-left outside any |
| 2690 // tab. Having big tab icons too looks kinda redonk. | 2718 // tab. Having big tab icons too looks kinda redonk. |
| 2691 return true; | 2719 return true; |
| 2692 } | 2720 } |
| 2693 | 2721 |
| 2694 /////////////////////////////////////////////////////////////////////////////// | 2722 /////////////////////////////////////////////////////////////////////////////// |
| 2695 // Browser, TabStripModelObserver implementation: | 2723 // Browser, TabStripModelObserver implementation: |
| 2696 | 2724 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3061 | 3089 |
| 3062 void Browser::UpdateDownloadShelfVisibility(bool visible) { | 3090 void Browser::UpdateDownloadShelfVisibility(bool visible) { |
| 3063 if (GetStatusBubble()) | 3091 if (GetStatusBubble()) |
| 3064 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); | 3092 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); |
| 3065 } | 3093 } |
| 3066 | 3094 |
| 3067 bool Browser::UseVerticalTabs() const { | 3095 bool Browser::UseVerticalTabs() const { |
| 3068 return use_vertical_tabs_.GetValue(); | 3096 return use_vertical_tabs_.GetValue(); |
| 3069 } | 3097 } |
| 3070 | 3098 |
| 3099 bool Browser::UseCompactNavigationBar() const { | |
| 3100 return use_compact_navigation_bar_.GetValue(); | |
| 3101 } | |
| 3102 | |
| 3071 void Browser::ContentsZoomChange(bool zoom_in) { | 3103 void Browser::ContentsZoomChange(bool zoom_in) { |
| 3072 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); | 3104 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); |
| 3073 } | 3105 } |
| 3074 | 3106 |
| 3075 void Browser::OnContentSettingsChange(TabContents* source) { | 3107 void Browser::OnContentSettingsChange(TabContents* source) { |
| 3076 if (source == GetSelectedTabContents()) { | 3108 if (source == GetSelectedTabContents()) { |
| 3077 LocationBar* location_bar = window()->GetLocationBar(); | 3109 LocationBar* location_bar = window()->GetLocationBar(); |
| 3078 if (location_bar) | 3110 if (location_bar) |
| 3079 location_bar->UpdateContentSettingsIcons(); | 3111 location_bar->UpdateContentSettingsIcons(); |
| 3080 } | 3112 } |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3460 GURL download_url = *(Details<GURL>(details).ptr()); | 3492 GURL download_url = *(Details<GURL>(details).ptr()); |
| 3461 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) | 3493 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) |
| 3462 window()->ShowThemeInstallBubble(); | 3494 window()->ShowThemeInstallBubble(); |
| 3463 break; | 3495 break; |
| 3464 } | 3496 } |
| 3465 | 3497 |
| 3466 case NotificationType::PREF_CHANGED: { | 3498 case NotificationType::PREF_CHANGED: { |
| 3467 const std::string& pref_name = *Details<std::string>(details).ptr(); | 3499 const std::string& pref_name = *Details<std::string>(details).ptr(); |
| 3468 if (pref_name == prefs::kUseVerticalTabs) { | 3500 if (pref_name == prefs::kUseVerticalTabs) { |
| 3469 UseVerticalTabsChanged(); | 3501 UseVerticalTabsChanged(); |
| 3502 } else if (pref_name == prefs::kUseCompactNavigationBar) { | |
| 3503 UseCompactNavigationBarChanged(); | |
| 3470 } else if (pref_name == prefs::kPrintingEnabled) { | 3504 } else if (pref_name == prefs::kPrintingEnabled) { |
| 3471 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); | 3505 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); |
| 3472 } else if (pref_name == prefs::kInstantEnabled) { | 3506 } else if (pref_name == prefs::kInstantEnabled) { |
| 3473 if (!InstantController::IsEnabled(profile())) { | 3507 if (!InstantController::IsEnabled(profile())) { |
| 3474 if (instant()) { | 3508 if (instant()) { |
| 3475 instant()->DestroyPreviewContents(); | 3509 instant()->DestroyPreviewContents(); |
| 3476 instant_.reset(); | 3510 instant_.reset(); |
| 3477 instant_unload_handler_.reset(); | 3511 instant_unload_handler_.reset(); |
| 3478 } | 3512 } |
| 3479 } else { | 3513 } else { |
| (...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4485 TabContents* current_tab = GetSelectedTabContents(); | 4519 TabContents* current_tab = GetSelectedTabContents(); |
| 4486 if (current_tab) { | 4520 if (current_tab) { |
| 4487 content_restrictions = current_tab->content_restrictions(); | 4521 content_restrictions = current_tab->content_restrictions(); |
| 4488 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4522 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
| 4489 // See comment in UpdateCommandsForTabState about why we call url(). | 4523 // See comment in UpdateCommandsForTabState about why we call url(). |
| 4490 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4524 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
| 4491 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4525 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| 4492 } | 4526 } |
| 4493 return content_restrictions; | 4527 return content_restrictions; |
| 4494 } | 4528 } |
| OLD | NEW |