| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); | 257 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); |
| 258 | 258 |
| 259 InitCommandState(); | 259 InitCommandState(); |
| 260 BrowserList::AddBrowser(this); | 260 BrowserList::AddBrowser(this); |
| 261 | 261 |
| 262 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 262 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
| 263 // or you'll get a nasty surprise when you run the incognito tests. | 263 // or you'll get a nasty surprise when you run the incognito tests. |
| 264 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 264 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 265 profile_->GetPrefs(), NULL); | 265 profile_->GetPrefs(), NULL); |
| 266 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); | 266 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); |
| 267 use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar, |
| 268 profile_->GetPrefs(), |
| 269 this); |
| 267 | 270 |
| 268 if (!TabMenuModel::AreVerticalTabsEnabled()) { | 271 if (!TabMenuModel::AreVerticalTabsEnabled()) { |
| 269 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we | 272 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we |
| 270 // might show vertical tabs but not show an option to turn them off. | 273 // might show vertical tabs but not show an option to turn them off. |
| 271 use_vertical_tabs_.SetValue(false); | 274 use_vertical_tabs_.SetValue(false); |
| 272 } | 275 } |
| 276 if (!TabMenuModel::IsCompactNavigationModeEnabled()) { |
| 277 // If the compact navigation bar isn't enabled, explicitly turn it off. |
| 278 // Otherwise we might show the compact navigation bar but not show an option |
| 279 // to turn it off. |
| 280 use_compact_navigation_bar_.SetValue(false); |
| 281 } |
| 282 |
| 273 UpdateTabStripModelInsertionPolicy(); | 283 UpdateTabStripModelInsertionPolicy(); |
| 274 | 284 |
| 275 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); | 285 tab_restore_service_ = TabRestoreServiceFactory::GetForProfile(profile); |
| 276 if (tab_restore_service_) { | 286 if (tab_restore_service_) { |
| 277 tab_restore_service_->AddObserver(this); | 287 tab_restore_service_->AddObserver(this); |
| 278 TabRestoreServiceChanged(tab_restore_service_); | 288 TabRestoreServiceChanged(tab_restore_service_); |
| 279 } | 289 } |
| 280 | 290 |
| 281 if (profile_->GetProfileSyncService()) | 291 if (profile_->GetProfileSyncService()) |
| 282 profile_->GetProfileSyncService()->AddObserver(this); | 292 profile_->GetProfileSyncService()->AddObserver(this); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 TabRestoreService* tab_restore_service = | 331 TabRestoreService* tab_restore_service = |
| 322 TabRestoreServiceFactory::GetForProfile(profile()); | 332 TabRestoreServiceFactory::GetForProfile(profile()); |
| 323 if (tab_restore_service) | 333 if (tab_restore_service) |
| 324 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); | 334 tab_restore_service->BrowserClosed(tab_restore_service_delegate()); |
| 325 | 335 |
| 326 profile_pref_registrar_.RemoveAll(); | 336 profile_pref_registrar_.RemoveAll(); |
| 327 local_pref_registrar_.RemoveAll(); | 337 local_pref_registrar_.RemoveAll(); |
| 328 | 338 |
| 329 encoding_auto_detect_.Destroy(); | 339 encoding_auto_detect_.Destroy(); |
| 330 use_vertical_tabs_.Destroy(); | 340 use_vertical_tabs_.Destroy(); |
| 341 use_compact_navigation_bar_.Destroy(); |
| 331 | 342 |
| 332 if (profile_->IsOffTheRecord() && | 343 if (profile_->IsOffTheRecord() && |
| 333 !BrowserList::IsOffTheRecordSessionActive()) { | 344 !BrowserList::IsOffTheRecordSessionActive()) { |
| 334 // An incognito profile is no longer needed, this indirectly | 345 // An incognito profile is no longer needed, this indirectly |
| 335 // frees its cache and cookies. | 346 // frees its cache and cookies. |
| 336 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); | 347 profile_->GetOriginalProfile()->DestroyOffTheRecordProfile(); |
| 337 } | 348 } |
| 338 | 349 |
| 339 // There may be pending file dialogs, we need to tell them that we've gone | 350 // There may be pending file dialogs, we need to tell them that we've gone |
| 340 // away so they don't try and call back to us. | 351 // away so they don't try and call back to us. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 ShellIntegration::GetChromiumAppId(profile_->GetPath()), | 431 ShellIntegration::GetChromiumAppId(profile_->GetPath()), |
| 421 window()->GetNativeHandle()); | 432 window()->GetNativeHandle()); |
| 422 } | 433 } |
| 423 #endif | 434 #endif |
| 424 | 435 |
| 425 NotificationService::current()->Notify( | 436 NotificationService::current()->Notify( |
| 426 NotificationType::BROWSER_WINDOW_READY, | 437 NotificationType::BROWSER_WINDOW_READY, |
| 427 Source<Browser>(this), | 438 Source<Browser>(this), |
| 428 NotificationService::NoDetails()); | 439 NotificationService::NoDetails()); |
| 429 | 440 |
| 441 if (use_compact_navigation_bar_.GetValue()) { |
| 442 // This enables the compact navigation bar host. |
| 443 UseCompactNavigationBarChanged(); |
| 444 } |
| 445 |
| 430 // Show the First Run information bubble if we've been told to. | 446 // Show the First Run information bubble if we've been told to. |
| 431 PrefService* local_state = g_browser_process->local_state(); | 447 PrefService* local_state = g_browser_process->local_state(); |
| 432 if (!local_state) | 448 if (!local_state) |
| 433 return; | 449 return; |
| 434 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && | 450 if (local_state->FindPreference(prefs::kShouldShowFirstRunBubble) && |
| 435 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { | 451 local_state->GetBoolean(prefs::kShouldShowFirstRunBubble)) { |
| 436 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; | 452 FirstRun::BubbleType bubble_type = FirstRun::LARGE_BUBBLE; |
| 437 if (local_state-> | 453 if (local_state-> |
| 438 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && | 454 FindPreference(prefs::kShouldUseOEMFirstRunBubble) && |
| 439 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { | 455 local_state->GetBoolean(prefs::kShouldUseOEMFirstRunBubble)) { |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 1225 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
| 1210 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 1226 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, |
| 1211 show_main_ui && profile_->IsSyncAccessible()); | 1227 show_main_ui && profile_->IsSyncAccessible()); |
| 1212 | 1228 |
| 1213 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 1229 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
| 1214 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 1230 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
| 1215 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 1231 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
| 1216 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 1232 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
| 1217 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); | 1233 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); |
| 1218 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); | 1234 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); |
| 1235 command_updater_.UpdateCommandEnabled(IDC_COMPACT_NAVBAR, show_main_ui); |
| 1219 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) | 1236 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) |
| 1220 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); | 1237 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); |
| 1221 #endif | 1238 #endif |
| 1222 } | 1239 } |
| 1223 | 1240 |
| 1224 /////////////////////////////////////////////////////////////////////////////// | 1241 /////////////////////////////////////////////////////////////////////////////// |
| 1225 // Browser, Assorted browser commands: | 1242 // Browser, Assorted browser commands: |
| 1226 | 1243 |
| 1227 bool Browser::ShouldOpenNewTabForWindowDisposition( | 1244 bool Browser::ShouldOpenNewTabForWindowDisposition( |
| 1228 WindowOpenDisposition disposition) { | 1245 WindowOpenDisposition disposition) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1246 void Browser::UpdateTabStripModelInsertionPolicy() { | 1263 void Browser::UpdateTabStripModelInsertionPolicy() { |
| 1247 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? | 1264 tab_handler_->GetTabStripModel()->SetInsertionPolicy(UseVerticalTabs() ? |
| 1248 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); | 1265 TabStripModel::INSERT_BEFORE : TabStripModel::INSERT_AFTER); |
| 1249 } | 1266 } |
| 1250 | 1267 |
| 1251 void Browser::UseVerticalTabsChanged() { | 1268 void Browser::UseVerticalTabsChanged() { |
| 1252 UpdateTabStripModelInsertionPolicy(); | 1269 UpdateTabStripModelInsertionPolicy(); |
| 1253 window()->ToggleTabStripMode(); | 1270 window()->ToggleTabStripMode(); |
| 1254 } | 1271 } |
| 1255 | 1272 |
| 1273 void Browser::UseCompactNavigationBarChanged() { |
| 1274 window_->ToggleUseCompactNavigationBar(); |
| 1275 } |
| 1276 |
| 1256 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, | 1277 bool Browser::SupportsWindowFeatureImpl(WindowFeature feature, |
| 1257 bool check_fullscreen) const { | 1278 bool check_fullscreen) const { |
| 1258 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On | 1279 // On Mac, fullscreen mode has most normal things (in a slide-down panel). On |
| 1259 // other platforms, we hide some controls when in fullscreen mode. | 1280 // other platforms, we hide some controls when in fullscreen mode. |
| 1260 bool hide_ui_for_fullscreen = false; | 1281 bool hide_ui_for_fullscreen = false; |
| 1261 #if !defined(OS_MACOSX) | 1282 #if !defined(OS_MACOSX) |
| 1262 hide_ui_for_fullscreen = check_fullscreen && window_ && | 1283 hide_ui_for_fullscreen = check_fullscreen && window_ && |
| 1263 window_->IsFullscreen(); | 1284 window_->IsFullscreen(); |
| 1264 #endif | 1285 #endif |
| 1265 | 1286 |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 PrefService::UNSYNCABLE_PREF); | 2164 PrefService::UNSYNCABLE_PREF); |
| 2144 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, | 2165 prefs->RegisterBooleanPref(prefs::kWebAppCreateInAppsMenu, |
| 2145 true, | 2166 true, |
| 2146 PrefService::UNSYNCABLE_PREF); | 2167 PrefService::UNSYNCABLE_PREF); |
| 2147 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, | 2168 prefs->RegisterBooleanPref(prefs::kWebAppCreateInQuickLaunchBar, |
| 2148 true, | 2169 true, |
| 2149 PrefService::UNSYNCABLE_PREF); | 2170 PrefService::UNSYNCABLE_PREF); |
| 2150 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, | 2171 prefs->RegisterBooleanPref(prefs::kUseVerticalTabs, |
| 2151 false, | 2172 false, |
| 2152 PrefService::UNSYNCABLE_PREF); | 2173 PrefService::UNSYNCABLE_PREF); |
| 2174 prefs->RegisterBooleanPref(prefs::kUseCompactNavigationBar, |
| 2175 false, |
| 2176 PrefService::UNSYNCABLE_PREF); |
| 2153 prefs->RegisterBooleanPref(prefs::kEnableTranslate, | 2177 prefs->RegisterBooleanPref(prefs::kEnableTranslate, |
| 2154 true, | 2178 true, |
| 2155 PrefService::SYNCABLE_PREF); | 2179 PrefService::SYNCABLE_PREF); |
| 2156 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, | 2180 prefs->RegisterBooleanPref(prefs::kEnableBookmarkBar, |
| 2157 true, | 2181 true, |
| 2158 PrefService::UNSYNCABLE_PREF); | 2182 PrefService::UNSYNCABLE_PREF); |
| 2159 prefs->RegisterStringPref(prefs::kCloudPrintEmail, | 2183 prefs->RegisterStringPref(prefs::kCloudPrintEmail, |
| 2160 std::string(), | 2184 std::string(), |
| 2161 PrefService::UNSYNCABLE_PREF); | 2185 PrefService::UNSYNCABLE_PREF); |
| 2162 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, | 2186 prefs->RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2292 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); | 2316 case IDC_SELECT_TAB_7: SelectNumberedTab(id - IDC_SELECT_TAB_0); |
| 2293 break; | 2317 break; |
| 2294 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; | 2318 case IDC_SELECT_LAST_TAB: SelectLastTab(); break; |
| 2295 case IDC_DUPLICATE_TAB: DuplicateTab(); break; | 2319 case IDC_DUPLICATE_TAB: DuplicateTab(); break; |
| 2296 case IDC_RESTORE_TAB: RestoreTab(); break; | 2320 case IDC_RESTORE_TAB: RestoreTab(); break; |
| 2297 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; | 2321 case IDC_COPY_URL: WriteCurrentURLToClipboard(); break; |
| 2298 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; | 2322 case IDC_SHOW_AS_TAB: ConvertPopupToTabbedBrowser(); break; |
| 2299 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; | 2323 case IDC_FULLSCREEN: ToggleFullscreenMode(); break; |
| 2300 case IDC_EXIT: Exit(); break; | 2324 case IDC_EXIT: Exit(); break; |
| 2301 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; | 2325 case IDC_TOGGLE_VERTICAL_TABS: ToggleUseVerticalTabs(); break; |
| 2326 case IDC_COMPACT_NAVBAR: ToggleUseCompactNavigationBar(); break; |
| 2302 #if defined(OS_CHROMEOS) | 2327 #if defined(OS_CHROMEOS) |
| 2303 case IDC_SEARCH: Search(); break; | 2328 case IDC_SEARCH: Search(); break; |
| 2304 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; | 2329 case IDC_SHOW_KEYBOARD_OVERLAY: ShowKeyboardOverlay(); break; |
| 2305 #endif | 2330 #endif |
| 2306 | 2331 |
| 2307 // Page-related commands | 2332 // Page-related commands |
| 2308 case IDC_SAVE_PAGE: SavePage(); break; | 2333 case IDC_SAVE_PAGE: SavePage(); break; |
| 2309 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; | 2334 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; |
| 2310 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; | 2335 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; |
| 2311 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; | 2336 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2767 TabCloseableStateWatcher* watcher = | 2792 TabCloseableStateWatcher* watcher = |
| 2768 g_browser_process->tab_closeable_state_watcher(); | 2793 g_browser_process->tab_closeable_state_watcher(); |
| 2769 return !watcher || watcher->CanCloseTab(this); | 2794 return !watcher || watcher->CanCloseTab(this); |
| 2770 } | 2795 } |
| 2771 | 2796 |
| 2772 void Browser::ToggleUseVerticalTabs() { | 2797 void Browser::ToggleUseVerticalTabs() { |
| 2773 use_vertical_tabs_.SetValue(!UseVerticalTabs()); | 2798 use_vertical_tabs_.SetValue(!UseVerticalTabs()); |
| 2774 UseVerticalTabsChanged(); | 2799 UseVerticalTabsChanged(); |
| 2775 } | 2800 } |
| 2776 | 2801 |
| 2802 void Browser::ToggleUseCompactNavigationBar() { |
| 2803 use_compact_navigation_bar_.SetValue(!UseCompactNavigationBar()); |
| 2804 UseCompactNavigationBarChanged(); |
| 2805 } |
| 2806 |
| 2777 bool Browser::LargeIconsPermitted() const { | 2807 bool Browser::LargeIconsPermitted() const { |
| 2778 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because | 2808 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because |
| 2779 // for those windows, we already have a big icon in the top-left outside any | 2809 // for those windows, we already have a big icon in the top-left outside any |
| 2780 // tab. Having big tab icons too looks kinda redonk. | 2810 // tab. Having big tab icons too looks kinda redonk. |
| 2781 return true; | 2811 return true; |
| 2782 } | 2812 } |
| 2783 | 2813 |
| 2784 /////////////////////////////////////////////////////////////////////////////// | 2814 /////////////////////////////////////////////////////////////////////////////// |
| 2785 // Browser, TabStripModelObserver implementation: | 2815 // Browser, TabStripModelObserver implementation: |
| 2786 | 2816 |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3151 | 3181 |
| 3152 void Browser::UpdateDownloadShelfVisibility(bool visible) { | 3182 void Browser::UpdateDownloadShelfVisibility(bool visible) { |
| 3153 if (GetStatusBubble()) | 3183 if (GetStatusBubble()) |
| 3154 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); | 3184 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); |
| 3155 } | 3185 } |
| 3156 | 3186 |
| 3157 bool Browser::UseVerticalTabs() const { | 3187 bool Browser::UseVerticalTabs() const { |
| 3158 return use_vertical_tabs_.GetValue(); | 3188 return use_vertical_tabs_.GetValue(); |
| 3159 } | 3189 } |
| 3160 | 3190 |
| 3191 bool Browser::UseCompactNavigationBar() const { |
| 3192 return use_compact_navigation_bar_.GetValue(); |
| 3193 } |
| 3194 |
| 3161 void Browser::ContentsZoomChange(bool zoom_in) { | 3195 void Browser::ContentsZoomChange(bool zoom_in) { |
| 3162 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); | 3196 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); |
| 3163 } | 3197 } |
| 3164 | 3198 |
| 3165 void Browser::OnContentSettingsChange(TabContents* source) { | 3199 void Browser::OnContentSettingsChange(TabContents* source) { |
| 3166 if (source == GetSelectedTabContents()) { | 3200 if (source == GetSelectedTabContents()) { |
| 3167 LocationBar* location_bar = window()->GetLocationBar(); | 3201 LocationBar* location_bar = window()->GetLocationBar(); |
| 3168 if (location_bar) | 3202 if (location_bar) |
| 3169 location_bar->UpdateContentSettingsIcons(); | 3203 location_bar->UpdateContentSettingsIcons(); |
| 3170 } | 3204 } |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3548 GURL download_url = *(Details<GURL>(details).ptr()); | 3582 GURL download_url = *(Details<GURL>(details).ptr()); |
| 3549 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) | 3583 if (ExtensionService::IsDownloadFromMiniGallery(download_url)) |
| 3550 window()->ShowThemeInstallBubble(); | 3584 window()->ShowThemeInstallBubble(); |
| 3551 break; | 3585 break; |
| 3552 } | 3586 } |
| 3553 | 3587 |
| 3554 case NotificationType::PREF_CHANGED: { | 3588 case NotificationType::PREF_CHANGED: { |
| 3555 const std::string& pref_name = *Details<std::string>(details).ptr(); | 3589 const std::string& pref_name = *Details<std::string>(details).ptr(); |
| 3556 if (pref_name == prefs::kUseVerticalTabs) { | 3590 if (pref_name == prefs::kUseVerticalTabs) { |
| 3557 UseVerticalTabsChanged(); | 3591 UseVerticalTabsChanged(); |
| 3592 } else if (pref_name == prefs::kUseCompactNavigationBar) { |
| 3593 UseCompactNavigationBarChanged(); |
| 3558 } else if (pref_name == prefs::kPrintingEnabled) { | 3594 } else if (pref_name == prefs::kPrintingEnabled) { |
| 3559 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); | 3595 UpdatePrintingState(GetContentRestrictionsForSelectedTab()); |
| 3560 } else if (pref_name == prefs::kInstantEnabled) { | 3596 } else if (pref_name == prefs::kInstantEnabled) { |
| 3561 if (!InstantController::IsEnabled(profile())) { | 3597 if (!InstantController::IsEnabled(profile())) { |
| 3562 if (instant()) { | 3598 if (instant()) { |
| 3563 instant()->DestroyPreviewContents(); | 3599 instant()->DestroyPreviewContents(); |
| 3564 instant_.reset(); | 3600 instant_.reset(); |
| 3565 instant_unload_handler_.reset(); | 3601 instant_unload_handler_.reset(); |
| 3566 } | 3602 } |
| 3567 } else { | 3603 } else { |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4565 TabContents* current_tab = GetSelectedTabContents(); | 4601 TabContents* current_tab = GetSelectedTabContents(); |
| 4566 if (current_tab) { | 4602 if (current_tab) { |
| 4567 content_restrictions = current_tab->content_restrictions(); | 4603 content_restrictions = current_tab->content_restrictions(); |
| 4568 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); | 4604 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); |
| 4569 // See comment in UpdateCommandsForTabState about why we call url(). | 4605 // See comment in UpdateCommandsForTabState about why we call url(). |
| 4570 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) | 4606 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) |
| 4571 content_restrictions |= CONTENT_RESTRICTION_SAVE; | 4607 content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| 4572 } | 4608 } |
| 4573 return content_restrictions; | 4609 return content_restrictions; |
| 4574 } | 4610 } |
| OLD | NEW |