| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 PrefService* local_state = g_browser_process->local_state(); | 235 PrefService* local_state = g_browser_process->local_state(); |
| 236 if (local_state) | 236 if (local_state) |
| 237 printing_enabled_.Init(prefs::kPrintingEnabled, local_state, this); | 237 printing_enabled_.Init(prefs::kPrintingEnabled, local_state, this); |
| 238 | 238 |
| 239 InitCommandState(); | 239 InitCommandState(); |
| 240 BrowserList::AddBrowser(this); | 240 BrowserList::AddBrowser(this); |
| 241 | 241 |
| 242 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 242 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 243 profile_->GetPrefs(), NULL); | 243 profile_->GetPrefs(), NULL); |
| 244 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); | 244 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); |
| 245 instant_enabled_.Init(prefs::kInstantEnabled, profile_->GetPrefs(), this); | |
| 246 if (!TabMenuModel::AreVerticalTabsEnabled()) { | 245 if (!TabMenuModel::AreVerticalTabsEnabled()) { |
| 247 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we | 246 // If vertical tabs aren't enabled, explicitly turn them off. Otherwise we |
| 248 // might show vertical tabs but not show an option to turn them off. | 247 // might show vertical tabs but not show an option to turn them off. |
| 249 use_vertical_tabs_.SetValue(false); | 248 use_vertical_tabs_.SetValue(false); |
| 250 } | 249 } |
| 251 UpdateTabStripModelInsertionPolicy(); | 250 UpdateTabStripModelInsertionPolicy(); |
| 252 | 251 |
| 253 tab_restore_service_ = profile->GetTabRestoreService(); | 252 tab_restore_service_ = profile->GetTabRestoreService(); |
| 254 if (tab_restore_service_) { | 253 if (tab_restore_service_) { |
| 255 tab_restore_service_->AddObserver(this); | 254 tab_restore_service_->AddObserver(this); |
| (...skipping 3104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 window()->ShowProfileErrorDialog(*message_id); | 3359 window()->ShowProfileErrorDialog(*message_id); |
| 3361 break; | 3360 break; |
| 3362 } | 3361 } |
| 3363 | 3362 |
| 3364 case NotificationType::PREF_CHANGED: { | 3363 case NotificationType::PREF_CHANGED: { |
| 3365 const std::string& pref_name = *Details<std::string>(details).ptr(); | 3364 const std::string& pref_name = *Details<std::string>(details).ptr(); |
| 3366 if (pref_name == prefs::kUseVerticalTabs) { | 3365 if (pref_name == prefs::kUseVerticalTabs) { |
| 3367 UseVerticalTabsChanged(); | 3366 UseVerticalTabsChanged(); |
| 3368 } else if (pref_name == prefs::kPrintingEnabled) { | 3367 } else if (pref_name == prefs::kPrintingEnabled) { |
| 3369 UpdatePrintingState(0); | 3368 UpdatePrintingState(0); |
| 3370 } else if (pref_name == prefs::kInstantEnabled) { | |
| 3371 if (!InstantController::IsEnabled(profile())) { | |
| 3372 if (instant()) { | |
| 3373 instant()->DestroyPreviewContents(); | |
| 3374 instant_.reset(NULL); | |
| 3375 } | |
| 3376 } else { | |
| 3377 CreateInstantIfNecessary(); | |
| 3378 } | |
| 3379 } else { | 3369 } else { |
| 3380 NOTREACHED(); | 3370 NOTREACHED(); |
| 3381 } | 3371 } |
| 3382 break; | 3372 break; |
| 3383 } | 3373 } |
| 3384 | 3374 |
| 3385 default: | 3375 default: |
| 3386 NOTREACHED() << "Got a notification we didn't register for."; | 3376 NOTREACHED() << "Got a notification we didn't register for."; |
| 3387 } | 3377 } |
| 3388 } | 3378 } |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4276 return true; | 4266 return true; |
| 4277 } | 4267 } |
| 4278 // The omnibox currently doesn't use other dispositions, so we don't attempt | 4268 // The omnibox currently doesn't use other dispositions, so we don't attempt |
| 4279 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add | 4269 // to handle them. If you hit this NOTREACHED file a bug and I'll (sky) add |
| 4280 // support for the new disposition. | 4270 // support for the new disposition. |
| 4281 NOTREACHED(); | 4271 NOTREACHED(); |
| 4282 return false; | 4272 return false; |
| 4283 } | 4273 } |
| 4284 | 4274 |
| 4285 void Browser::CreateInstantIfNecessary() { | 4275 void Browser::CreateInstantIfNecessary() { |
| 4286 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4276 if (type() == TYPE_NORMAL && InstantController::IsEnabled() && |
| 4287 !profile()->IsOffTheRecord()) { | 4277 !profile()->IsOffTheRecord()) { |
| 4288 instant_.reset(new InstantController(this)); | 4278 instant_.reset(new InstantController(this)); |
| 4289 } | 4279 } |
| 4290 } | 4280 } |
| OLD | NEW |