| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "chrome/browser/app_mode/app_mode_utils.h" | 28 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/defaults.h" | 30 #include "chrome/browser/defaults.h" |
| 31 #include "chrome/browser/extensions/app_icon_loader_impl.h" | 31 #include "chrome/browser/extensions/app_icon_loader_impl.h" |
| 32 #include "chrome/browser/extensions/extension_util.h" | 32 #include "chrome/browser/extensions/extension_util.h" |
| 33 #include "chrome/browser/extensions/launch_util.h" | 33 #include "chrome/browser/extensions/launch_util.h" |
| 34 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 34 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 35 #include "chrome/browser/prefs/pref_service_syncable.h" | 35 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 36 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 36 #include "chrome/browser/profiles/profile.h" | 37 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/profiles/profile_manager.h" | 38 #include "chrome/browser/profiles/profile_manager.h" |
| 38 #include "chrome/browser/ui/ash/app_sync_ui_state.h" | 39 #include "chrome/browser/ui/ash/app_sync_ui_state.h" |
| 39 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" | 40 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 40 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" | 41 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" |
| 41 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" | 42 #include "chrome/browser/ui/ash/launcher/app_window_launcher_controller.h" |
| 42 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" | 43 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" |
| 43 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" | 44 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 44 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" | 45 #include "chrome/browser/ui/ash/launcher/browser_status_monitor.h" |
| 45 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 46 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 CreateBrowserShortcutLauncherItem(); | 472 CreateBrowserShortcutLauncherItem(); |
| 472 UpdateAppLaunchersFromPref(); | 473 UpdateAppLaunchersFromPref(); |
| 473 | 474 |
| 474 // TODO(sky): update unit test so that this test isn't necessary. | 475 // TODO(sky): update unit test so that this test isn't necessary. |
| 475 if (ash::Shell::HasInstance()) { | 476 if (ash::Shell::HasInstance()) { |
| 476 SetShelfAutoHideBehaviorFromPrefs(); | 477 SetShelfAutoHideBehaviorFromPrefs(); |
| 477 SetShelfAlignmentFromPrefs(); | 478 SetShelfAlignmentFromPrefs(); |
| 478 #if defined(OS_CHROMEOS) | 479 #if defined(OS_CHROMEOS) |
| 479 SetVirtualKeyboardBehaviorFromPrefs(); | 480 SetVirtualKeyboardBehaviorFromPrefs(); |
| 480 #endif // defined(OS_CHROMEOS) | 481 #endif // defined(OS_CHROMEOS) |
| 481 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_); | 482 PrefServiceSyncable* prefs = PrefServiceSyncableFromProfile(profile_); |
| 482 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || | 483 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || |
| 483 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> | 484 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> |
| 484 HasUserSetting()) { | 485 HasUserSetting()) { |
| 485 // This causes OnIsSyncingChanged to be called when the value of | 486 // This causes OnIsSyncingChanged to be called when the value of |
| 486 // PrefService::IsSyncing() changes. | 487 // PrefService::IsSyncing() changes. |
| 487 prefs->AddObserver(this); | 488 prefs->AddObserver(this); |
| 488 } | 489 } |
| 489 ash::Shell::GetInstance()->AddShellObserver(this); | 490 ash::Shell::GetInstance()->AddShellObserver(this); |
| 490 } | 491 } |
| 491 } | 492 } |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); | 1232 profile_->GetPrefs()->SetString(prefs::kShelfAlignmentLocal, pref_value); |
| 1232 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); | 1233 profile_->GetPrefs()->SetString(prefs::kShelfAlignment, pref_value); |
| 1233 } | 1234 } |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1236 void ChromeLauncherController::OnDisplayConfigurationChanged() { | 1237 void ChromeLauncherController::OnDisplayConfigurationChanged() { |
| 1237 SetShelfBehaviorsFromPrefs(); | 1238 SetShelfBehaviorsFromPrefs(); |
| 1238 } | 1239 } |
| 1239 | 1240 |
| 1240 void ChromeLauncherController::OnIsSyncingChanged() { | 1241 void ChromeLauncherController::OnIsSyncingChanged() { |
| 1241 PrefServiceSyncable* prefs = PrefServiceSyncable::FromProfile(profile_); | 1242 PrefServiceSyncable* prefs = PrefServiceSyncableFromProfile(profile_); |
| 1242 MaybePropagatePrefToLocal(prefs, | 1243 MaybePropagatePrefToLocal(prefs, |
| 1243 prefs::kShelfAlignmentLocal, | 1244 prefs::kShelfAlignmentLocal, |
| 1244 prefs::kShelfAlignment); | 1245 prefs::kShelfAlignment); |
| 1245 MaybePropagatePrefToLocal(prefs, | 1246 MaybePropagatePrefToLocal(prefs, |
| 1246 prefs::kShelfAutoHideBehaviorLocal, | 1247 prefs::kShelfAutoHideBehaviorLocal, |
| 1247 prefs::kShelfAutoHideBehavior); | 1248 prefs::kShelfAutoHideBehavior); |
| 1248 } | 1249 } |
| 1249 | 1250 |
| 1250 void ChromeLauncherController::OnAppSyncUIStatusChanged() { | 1251 void ChromeLauncherController::OnAppSyncUIStatusChanged() { |
| 1251 if (app_sync_ui_state_->status() == AppSyncUIState::STATUS_SYNCING) | 1252 if (app_sync_ui_state_->status() == AppSyncUIState::STATUS_SYNCING) |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 | 2096 |
| 2096 extensions::ExtensionRegistry::Get(profile_)->AddObserver(this); | 2097 extensions::ExtensionRegistry::Get(profile_)->AddObserver(this); |
| 2097 } | 2098 } |
| 2098 | 2099 |
| 2099 void ChromeLauncherController::ReleaseProfile() { | 2100 void ChromeLauncherController::ReleaseProfile() { |
| 2100 if (app_sync_ui_state_) | 2101 if (app_sync_ui_state_) |
| 2101 app_sync_ui_state_->RemoveObserver(this); | 2102 app_sync_ui_state_->RemoveObserver(this); |
| 2102 | 2103 |
| 2103 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); | 2104 extensions::ExtensionRegistry::Get(profile_)->RemoveObserver(this); |
| 2104 | 2105 |
| 2105 PrefServiceSyncable::FromProfile(profile_)->RemoveObserver(this); | 2106 PrefServiceSyncableFromProfile(profile_)->RemoveObserver(this); |
| 2106 | 2107 |
| 2107 pref_change_registrar_.RemoveAll(); | 2108 pref_change_registrar_.RemoveAll(); |
| 2108 } | 2109 } |
| OLD | NEW |