| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); | 256 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); |
| 257 | 257 |
| 258 InitCommandState(); | 258 InitCommandState(); |
| 259 BrowserList::AddBrowser(this); | 259 BrowserList::AddBrowser(this); |
| 260 | 260 |
| 261 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 261 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
| 262 // or you'll get a nasty surprise when you run the incognito tests. | 262 // or you'll get a nasty surprise when you run the incognito tests. |
| 263 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 263 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 264 profile_->GetPrefs(), NULL); | 264 profile_->GetPrefs(), NULL); |
| 265 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); | 265 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); |
| 266 use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar, |
| 267 profile_->GetPrefs(), |
| 268 this); |
| 266 | 269 |
| 267 if (!TabMenuModel::AreVerticalTabsEnabled()) { | 270 if (!TabMenuModel::AreVerticalTabsEnabled()) { |
| 268 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we | 271 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we |
| 269 // might show vertical tabs but not show an option to turn them off. | 272 // might show vertical tabs but not show an option to turn them off. |
| 270 use_vertical_tabs_.SetValue(false); | 273 use_vertical_tabs_.SetValue(false); |
| 271 } | 274 } |
| 275 if (!TabMenuModel::IsCompactNavigationModeEnabled()) { |
| 276 // If the compact navigation bar isn't enabled, explicitly turn it off. |
| 277 // Otherwise we might show the compact navigation bar but not show an option |
| 278 // to turn it off. |
| 279 use_compact_navigation_bar_.SetValue(false); |
| 280 } |
| 281 |
| 272 UpdateTabStripModelInsertionPolicy(); | 282 UpdateTabStripModelInsertionPolicy(); |
| 273 | 283 |
| 274 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); | 284 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); |
| 275 if (tab_restore_service_) { | 285 if (tab_restore_service_) { |
| 276 tab_restore_service_->AddObserver(this); | 286 tab_restore_service_->AddObserver(this); |
| 277 TabRestoreServiceChanged(tab_restore_service_); | 287 TabRestoreServiceChanged(tab_restore_service_); |
| 278 } | 288 } |
| 279 | 289 |
| 280 if (profile_->GetProfileSyncService()) | 290 if (profile_->GetProfileSyncService()) |
| 281 profile_->GetProfileSyncService()->AddObserver(this); | 291 profile_->GetProfileSyncService()->AddObserver(this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 TabRestoreService* tab_restore_service = | 330 TabRestoreService* tab_restore_service = |
| 321 TabRestoreServiceFactory::GetForProfile(profile()); | 331 TabRestoreServiceFactory::GetForProfile(profile()); |
| 322 if (tab_restore_service) | 332 if (tab_restore_service) |
| 323 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); | 333 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); |
| 324 | 334 |
| 325 profile_pref_registrar_.RemoveAll(); | 335 profile_pref_registrar_.RemoveAll(); |
| 326 local_pref_registrar_.RemoveAll(); | 336 local_pref_registrar_.RemoveAll(); |
| 327 | 337 |
| 328 encoding_auto_detect_.Destroy(); | 338 encoding_auto_detect_.Destroy(); |
| 329 use_vertical_tabs_.Destroy(); | 339 use_vertical_tabs_.Destroy(); |
| 340 use_compact_navigation_bar_.Destroy(); |
| 330 | 341 |
| 331 if (profile_->IsOffTheRecord() && | 342 if (profile_->IsOffTheRecord() && |
| 332 !BrowserList::IsOffTheRecordSessionActive()) { | 343 !BrowserList::IsOffTheRecordSessionActive()) { |
| 333 // An incognito profile is no longer needed, this indirectly | 344 // An incognito profile is no longer needed, this indirectly |
| 334 // frees its cache and cookies. | 345 // frees its cache and cookies. |
| 335 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); | 346 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); |
| 336 } | 347 } |
| 337 | 348 |
| 338 // There may be pending file dialogs, we need to tell them that we've gone | 349 // There may be pending file dialogs, we need to tell them that we've gone |
| 339 // away so they don't try and call back to us. | 350 // away so they don't try and call back to us. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 ShellIntegration::GetChromiumAppId(profile_->GetPath()), | 430 ShellIntegration::GetChromiumAppId(profile_->GetPath()), |
| 420 window()->GetNativeHandle()); | 431 window()->GetNativeHandle()); |
| 421 } | 432 } |
| 422 #endif | 433 #endif |
| 423 | 434 |
| 424 NotificationService::current()->Notify( | 435 NotificationService::current()->Notify( |
| 425 NotificationType::BROWSER_WINDOW_READY, | 436 NotificationType::BROWSER_WINDOW_READY, |
| 426 Source<Browser>(this), | 437 Source<Browser>(this), |
| 427 NotificationService::NoDetails()); | 438 NotificationService::NoDetails()); |
| 428 | 439 |
| 440 if (use_compact_navigation_bar_.GetValue()) { |
| 441 // This enables the compact navigation bar host. |
| 442 UseCompactNavigationBarChanged(); |
| 443 } |
| 444 |
| 429 // Show the First Run information bubble if we've been told to. | 445 // Show the First Run information bubble if we've been told to. |
| 430 PrefService* local_state = g_browser_process->local_state(); | 446 PrefService* local_state = g_browser_process->local_state(); |
| 431 if (!local_state) | 447 if (!local_state) |
| 432 return; | 448 return; |
| 433 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && | 449 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && |
| 434 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 450 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 435 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; | 451 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; |
| 436 if (local_state-> | 452 if (local_state-> |
| 437 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && | 453 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && |
| 438 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { | 454 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 1224 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
| 1209 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 1225 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, |
| 1210 show_main_ui && profile_->IsSyncAccessible()); | 1226 show_main_ui && profile_->IsSyncAccessible()); |
| 1211 | 1227 |
| 1212 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 1228 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
| 1213 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 1229 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
| 1214 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 1230 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
| 1215 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 1231 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
| 1216 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); | 1232 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); |
| 1217 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); | 1233 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); |
| 1234 command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, show_main_ui); |
| 1218 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) | 1235 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) |
| 1219 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); | 1236 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); |
| 1220 #endif | 1237 #endif |
| 1221 } | 1238 } |
| 1222 | 1239 |
| 1223 /////////////////////////////////////////////////////////////////////////////// | 1240 /////////////////////////////////////////////////////////////////////////////// |
| 1224 // Browser, Assorted browser commands: | 1241 // Browser, Assorted browser commands: |
| 1225 | 1242 |
| 1226 bool Browser::ShouldOpenNewTabForWindowDisposition( | 1243 bool Browser::ShouldOpenNewTabForWindowDisposition( |
| 1227 WindowOpenDisposition disposition) { | 1244 WindowOpenDisposition disposition) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1245 void Browser::UpdateTabStripModelInsertionPolicy() { | 1262 void Browser::UpdateTabStripModelInsertionPolicy() { |
| 1246 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? | 1263 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? |
| 1247 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); | 1264 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); |
| 1248 } | 1265 } |
| 1249 | 1266 |
| 1250 void Browser::UseVerticalTabsChanged() { | 1267 void Browser::UseVerticalTabsChanged() { |
| 1251 UpdateTabStripModelInsertionPolicy(); | 1268 UpdateTabStripModelInsertionPolicy(); |
| 1252 window()->ToggleTabStripMode(); | 1269 window()->ToggleTabStripMode(); |
| 1253 } | 1270 } |
| 1254 | 1271 |
| 1272 void Browser::UseCompactNavigationBarChanged() { |
| 1273 window_->ToggleUseCompactNavigationBar(); |
| 1274 } |
| 1275 |
| 1255 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, | 1276 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, |
| 1256 bool check_fullscreen) const { | 1277 bool check_fullscreen) const { |
| 1257 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 1278 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
| 1258 // other platforms, we hide some controls when in fullscreen mode. | 1279 // other platforms, we hide some controls when in fullscreen mode. |
| 1259 bool hide_ui_for_fullscreen = false; | 1280 bool hide_ui_for_fullscreen = false; |
| 1260 #if !defined(OS_MACOSX) | 1281 #if !defined(OS_MACOSX) |
| 1261 hide_ui_for_fullscreen = check_fullscreen && window_ && | 1282 hide_ui_for_fullscreen = check_fullscreen && window_ && |
| 1262 window_->IsFullscreen(); | 1283 window_->IsFullscreen(); |
| 1263 #endif | 1284 #endif |
| 1264 | 1285 |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 prefs->RegisterBooleanPref(prefs::kDeleteCookies, true); | 2130 prefs->RegisterBooleanPref(prefs::kDeleteCookies, true); |
| 2110 prefs->RegisterBooleanPref(prefs::kDeletePasswords, false); | 2131 prefs->RegisterBooleanPref(prefs::kDeletePasswords, false); |
| 2111 prefs->RegisterBooleanPref(prefs::kDeleteFormData, false); | 2132 prefs->RegisterBooleanPref(prefs::kDeleteFormData, false); |
| 2112 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); | 2133 prefs->RegisterIntegerPref(prefs::kDeleteTimePeriod, 0); |
| 2113 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); | 2134 prefs->RegisterBooleanPref(prefs::kCheckDefaultBrowser, true); |
| 2114 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); | 2135 prefs->RegisterBooleanPref(prefs::kShowOmniboxSearchHint, true); |
| 2115 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); | 2136 prefs->RegisterBooleanPref(prefs::kWebAppCreateOnDesktop, true); |
| 2116 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); | 2137 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, true); |
| 2117 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); | 2138 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, true); |
| 2118 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); | 2139 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, false); |
| 2140 prefs->RegisterBooleanPref(prefs::kUseCompactNavigationBar, false); |
| 2119 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); | 2141 prefs->RegisterBooleanPref(prefs::kEnableTranslate, true); |
| 2120 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, true); | 2142 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, true); |
| 2121 prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); | 2143 prefs->RegisterBooleanPref(prefs::kRemotingHasSetupCompleted, false); |
| 2122 prefs->RegisterBooleanPref(prefs::kChromotingEnabled, false); | 2144 prefs->RegisterBooleanPref(prefs::kChromotingEnabled, false); |
| 2123 prefs->RegisterBooleanPref(prefs::kChromotingHostEnabled, false); | 2145 prefs->RegisterBooleanPref(prefs::kChromotingHostEnabled, false); |
| 2124 prefs->RegisterBooleanPref(prefs::kChromotingHostFirewallTraversal, false); | 2146 prefs->RegisterBooleanPref(prefs::kChromotingHostFirewallTraversal, false); |
| 2125 prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); | 2147 prefs->RegisterStringPref(prefs::kCloudPrintEmail, std::string()); |
| 2126 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true); | 2148 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, true); |
| 2127 prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); | 2149 prefs->RegisterBooleanPref(prefs::kDevToolsDisabled, false); |
| 2128 prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); | 2150 prefs->RegisterBooleanPref(prefs::kIncognitoEnabled, true); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2234 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); | 2256 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); |
| 2235 break; | 2257 break; |
| 2236 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 2258 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
| 2237 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 2259 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
| 2238 case IDC_RESTORE_TAB: RestoreTab(); break; | 2260 case IDC_RESTORE_TAB: RestoreTab(); break; |
| 2239 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 2261 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
| 2240 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 2262 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
| 2241 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 2263 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
| 2242 case IDC_EXIT: Exit(); break; | 2264 case IDC_EXIT: Exit(); break; |
| 2243 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; | 2265 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; |
| 2266 case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break; |
| 2244 #if defined(OS_CHROMEOS) | 2267 #if defined(OS_CHROMEOS) |
| 2245 case IDC_SEARCH: Search(); break; | 2268 case IDC_SEARCH: Search(); break; |
| 2246 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; | 2269 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; |
| 2247 #endif | 2270 #endif |
| 2248 | 2271 |
| 2249 // Page-related commands | 2272 // Page-related commands |
| 2250 case IDC_SAVE_PAGE: SavePage(); break; | 2273 case IDC_SAVE_PAGE: SavePage(); break; |
| 2251 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; | 2274 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; |
| 2252 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; | 2275 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; |
| 2253 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; | 2276 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2709 TabCloseableStateWatcher* watcher = | 2732 TabCloseableStateWatcher* watcher = |
| 2710 g_browser_process->tab_closeable_state_watcher(); | 2733 g_browser_process->tab_closeable_state_watcher(); |
| 2711 return !watcher || watcher->CanCloseTab(this); | 2734 return !watcher || watcher->CanCloseTab(this); |
| 2712 } | 2735 } |
| 2713 | 2736 |
| 2714 void Browser::ToggleUseVerticalTabs() { | 2737 void Browser::ToggleUseVerticalTabs() { |
| 2715 use_vertical_tabs_.SetValue(!UseVerticalTabs()); | 2738 use_vertical_tabs_.SetValue(!UseVerticalTabs()); |
| 2716 UseVerticalTabsChanged(); | 2739 UseVerticalTabsChanged(); |
| 2717 } | 2740 } |
| 2718 | 2741 |
| 2742 void Browser::ToggleUseCompactNavigationBar() { |
| 2743 use_compact_navigation_bar_.SetValue(!UseCompactNavigationBar()); |
| 2744 UseCompactNavigationBarChanged(); |
| 2745 } |
| 2746 |
| 2719 bool Browser::LargeIconsPermitted() const { | 2747 bool Browser::LargeIconsPermitted() const { |
| 2720 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because | 2748 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because |
| 2721 // for those windows, we already have a big icon in the top-left outside any | 2749 // for those windows, we already have a big icon in the top-left outside any |
| 2722 // tab. Having big tab icons too looks kinda redonk. | 2750 // tab. Having big tab icons too looks kinda redonk. |
| 2723 return true; | 2751 return true; |
| 2724 } | 2752 } |
| 2725 | 2753 |
| 2726 /////////////////////////////////////////////////////////////////////////////// | 2754 /////////////////////////////////////////////////////////////////////////////// |
| 2727 // Browser, TabStripModelObserver implementation: | 2755 // Browser, TabStripModelObserver implementation: |
| 2728 | 2756 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3093 | 3121 |
| 3094 void Browser::UpdateDownloadShelfVisibility(bool visible) { | 3122 void Browser::UpdateDownloadShelfVisibility(bool visible) { |
| 3095 if (GetStatusBubble()) | 3123 if (GetStatusBubble()) |
| 3096 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); | 3124 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); |
| 3097 } | 3125 } |
| 3098 | 3126 |
| 3099 bool Browser::UseVerticalTabs() const { | 3127 bool Browser::UseVerticalTabs() const { |
| 3100 return use_vertical_tabs_.GetValue(); | 3128 return use_vertical_tabs_.GetValue(); |
| 3101 } | 3129 } |
| 3102 | 3130 |
| 3131 bool Browser::UseCompactNavigationBar() const { |
| 3132 return use_compact_navigation_bar_.GetValue(); |
| 3133 } |
| 3134 |
| 3103 void Browser::ContentsZoomChange(bool zoom_in) { | 3135 void Browser::ContentsZoomChange(bool zoom_in) { |
| 3104 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); | 3136 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); |
| 3105 } | 3137 } |
| 3106 | 3138 |
| 3107 void Browser::OnContentSettingsChange(TabContents* source) { | 3139 void Browser::OnContentSettingsChange(TabContents* source) { |
| 3108 if (source == GetSelectedTabContents()) { | 3140 if (source == GetSelectedTabContents()) { |
| 3109 LocationBar* location_bar = window()->GetLocationBar(); | 3141 LocationBar* location_bar = window()->GetLocationBar(); |
| 3110 if (location_bar) | 3142 if (location_bar) |
| 3111 location_bar->UpdateContentSettingsIcons(); | 3143 location_bar->UpdateContentSettingsIcons(); |
| 3112 } | 3144 } |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3492 GURL download_url = *(Details<GURL>(details).ptr()); | 3524 GURL download_url = *(Details<GURL>(details).ptr()); |
| 3493 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) | 3525 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) |
| 3494 window()->ShowThemeInstallBubble(); | 3526 window()->ShowThemeInstallBubble(); |
| 3495 break; | 3527 break; |
| 3496 } | 3528 } |
| 3497 | 3529 |
| 3498 case NotificationType::PREF_CHANGED: { | 3530 case NotificationType::PREF_CHANGED: { |
| 3499 const std::string& pref_name = *Details<std::string>(details).ptr(); | 3531 const std::string& pref_name = *Details<std::string>(details).ptr(); |
| 3500 if (pref_name == prefs::kUseVerticalTabs) { | 3532 if (pref_name == prefs::kUseVerticalTabs) { |
| 3501 UseVerticalTabsChanged(); | 3533 UseVerticalTabsChanged(); |
| 3534 } else if (pref_name == prefs::kUseCompactNavigationBar) { |
| 3535 UseCompactNavigationBarChanged(); |
| 3502 } else if (pref_name == prefs::kPrintingEnabled) { | 3536 } else if (pref_name == prefs::kPrintingEnabled) { |
| 3503 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); | 3537 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); |
| 3504 } else if (pref_name == prefs::kInstantEnabled) { | 3538 } else if (pref_name == prefs::kInstantEnabled) { |
| 3505 if (!InstantController::IsEnabled(profile())) { | 3539 if (!InstantController::IsEnabled(profile())) { |
| 3506 if (instant()) { | 3540 if (instant()) { |
| 3507 instant()->DestroyPreviewContents(); | 3541 instant()->DestroyPreviewContents(); |
| 3508 instant_.reset(); | 3542 instant_.reset(); |
| 3509 instant_unload_handler_.reset(); | 3543 instant_unload_handler_.reset(); |
| 3510 } | 3544 } |
| 3511 } else { | 3545 } else { |
| (...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4505 TabContents* current_tab = GetSelectedTabContents(); | 4539 TabContents* current_tab = GetSelectedTabContents(); |
| 4506 if (current_tab) { | 4540 if (current_tab) { |
| 4507 content_restrictions = current_tab->content_restrictions(); | 4541 content_restrictions = current_tab->content_restrictions(); |
| 4508 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4542 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
| 4509 // See comment in UpdateCommandsForTabState about why we call url(). | 4543 // See comment in UpdateCommandsForTabState about why we call url(). |
| 4510 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4544 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
| 4511 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4545 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| 4512 } | 4546 } |
| 4513 return content_restrictions; | 4547 return content_restrictions; |
| 4514 } | 4548 } |
| OLD | NEW |