| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 PrefService* local_state = g_browser_process->local_state(); | 233 PrefService* local_state = g_browser_process->local_state(); |
| 234 if (local_state) | 234 if (local_state) |
| 235 printing_enabled_.Init(prefs::kPrintingEnabled, local_state, this); | 235 printing_enabled_.Init(prefs::kPrintingEnabled, local_state, this); |
| 236 | 236 |
| 237 InitCommandState(); | 237 InitCommandState(); |
| 238 BrowserList::AddBrowser(this); | 238 BrowserList::AddBrowser(this); |
| 239 | 239 |
| 240 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 240 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 241 profile_->GetPrefs(), NULL); | 241 profile_->GetPrefs(), NULL); |
| 242 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); | 242 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); |
| 243 instant_enabled_.Init(prefs::kInstantEnabled, profile_->GetPrefs(), this); | |
| 244 if (!TabMenuModel::AreVerticalTabsEnabled()) { | 243 if (!TabMenuModel::AreVerticalTabsEnabled()) { |
| 245 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we | 244 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we |
| 246 // might show vertical tabs but not show an option to turn them off. | 245 // might show vertical tabs but not show an option to turn them off. |
| 247 use_vertical_tabs_.SetValue(false); | 246 use_vertical_tabs_.SetValue(false); |
| 248 } | 247 } |
| 249 UpdateTabStripModelInsertionPolicy(); | 248 UpdateTabStripModelInsertionPolicy(); |
| 250 | 249 |
| 251 tab_restore_service_ = profile->GetTabRestoreService(); | 250 tab_restore_service_ = profile->GetTabRestoreService(); |
| 252 if (tab_restore_service_) { | 251 if (tab_restore_service_) { |
| 253 tab_restore_service_->AddObserver(this); | 252 tab_restore_service_->AddObserver(this); |
| (...skipping 3047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 window()->ShowProfileErrorDialog(*message_id); | 3300 window()->ShowProfileErrorDialog(*message_id); |
| 3302 break; | 3301 break; |
| 3303 } | 3302 } |
| 3304 | 3303 |
| 3305 case NotificationType::PREF_CHANGED: { | 3304 case NotificationType::PREF_CHANGED: { |
| 3306 const std::string& pref_name = *Details<std::string>(details).ptr(); | 3305 const std::string& pref_name = *Details<std::string>(details).ptr(); |
| 3307 if (pref_name == prefs::kUseVerticalTabs) { | 3306 if (pref_name == prefs::kUseVerticalTabs) { |
| 3308 UseVerticalTabsChanged(); | 3307 UseVerticalTabsChanged(); |
| 3309 } else if (pref_name == prefs::kPrintingEnabled) { | 3308 } else if (pref_name == prefs::kPrintingEnabled) { |
| 3310 UpdatePrintingState(0); | 3309 UpdatePrintingState(0); |
| 3311 } else if (pref_name == prefs::kInstantEnabled) { | |
| 3312 if (!InstantController::IsEnabled(profile())) { | |
| 3313 if (instant()) { | |
| 3314 instant()->DestroyPreviewContents(); | |
| 3315 instant_.reset(NULL); | |
| 3316 } | |
| 3317 } else { | |
| 3318 CreateInstantIfNecessary(); | |
| 3319 } | |
| 3320 } else { | 3310 } else { |
| 3321 NOTREACHED(); | 3311 NOTREACHED(); |
| 3322 } | 3312 } |
| 3323 break; | 3313 break; |
| 3324 } | 3314 } |
| 3325 | 3315 |
| 3326 default: | 3316 default: |
| 3327 NOTREACHED() << "Got a notification we didn't register for."; | 3317 NOTREACHED() << "Got a notification we didn't register for."; |
| 3328 } | 3318 } |
| 3329 } | 3319 } |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4239 return true; | 4229 return true; |
| 4240 } | 4230 } |
| 4241 // The omnibox currently doesn't use other dispositions, so we don't attempt | 4231 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 4242 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add | 4232 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add |
| 4243 // support for the new disposition. | 4233 // support for the new disposition. |
| 4244 NOTREACHED(); | 4234 NOTREACHED(); |
| 4245 return false; | 4235 return false; |
| 4246 } | 4236 } |
| 4247 | 4237 |
| 4248 void Browser::CreateInstantIfNecessary() { | 4238 void Browser::CreateInstantIfNecessary() { |
| 4249 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4239 if (type() == TYPE_NORMAL && InstantController::IsEnabled() && |
| 4250 !profile()->IsOffTheRecord()) { | 4240 !profile()->IsOffTheRecord()) { |
| 4251 instant_.reset(new InstantController(this)); | 4241 instant_.reset(new InstantController(this)); |
| 4252 } | 4242 } |
| 4253 } | 4243 } |
| OLD | NEW |