Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_per_browser. h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser. h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 display_pref->GetString(path, &per_display_value)) { 179 display_pref->GetString(path, &per_display_value)) {
180 return per_display_value; 180 return per_display_value;
181 } 181 }
182 } 182 }
183 183
184 return value; 184 return value;
185 } 185 }
186 186
187 // If prefs have synced and no user-set value exists at |local_path|, the value 187 // If prefs have synced and no user-set value exists at |local_path|, the value
188 // from |synced_path| is copied to |local_path|. 188 // from |synced_path| is copied to |local_path|.
189 void MaybePropagatePrefToLocal(PrefService* pref_service, 189 void MaybePropagatePrefToLocal(PrefServiceSyncable* pref_service,
190 const char* local_path, 190 const char* local_path,
191 const char* synced_path) { 191 const char* synced_path) {
192 if (!pref_service->FindPreference(local_path)->HasUserSetting() && 192 if (!pref_service->FindPreference(local_path)->HasUserSetting() &&
193 pref_service->IsSyncing()) { 193 pref_service->IsSyncing()) {
194 // First time the user is using this machine, propagate from remote to 194 // First time the user is using this machine, propagate from remote to
195 // local. 195 // local.
196 pref_service->SetString(local_path, pref_service->GetString(synced_path)); 196 pref_service->SetString(local_path, pref_service->GetString(synced_path));
197 } 197 }
198 } 198 }
199 199
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 profile_->GetPrefs()->RemoveObserver(this); 268 profile_->GetPrefs()->RemoveObserver(this);
269 } 269 }
270 270
271 void ChromeLauncherControllerPerBrowser::Init() { 271 void ChromeLauncherControllerPerBrowser::Init() {
272 UpdateAppLaunchersFromPref(); 272 UpdateAppLaunchersFromPref();
273 273
274 // TODO(sky): update unit test so that this test isn't necessary. 274 // TODO(sky): update unit test so that this test isn't necessary.
275 if (ash::Shell::HasInstance()) { 275 if (ash::Shell::HasInstance()) {
276 SetShelfAutoHideBehaviorFromPrefs(); 276 SetShelfAutoHideBehaviorFromPrefs();
277 SetShelfAlignmentFromPrefs(); 277 SetShelfAlignmentFromPrefs();
278 PrefService* prefs = profile_->GetPrefs(); 278 PrefServiceSyncable* prefs = profile_->GetPrefs();
279 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() || 279 if (!prefs->FindPreference(prefs::kShelfAlignmentLocal)->HasUserSetting() ||
280 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)-> 280 !prefs->FindPreference(prefs::kShelfAutoHideBehaviorLocal)->
281 HasUserSetting()) { 281 HasUserSetting()) {
282 // This causes OnIsSyncingChanged to be called when the value of 282 // This causes OnIsSyncingChanged to be called when the value of
283 // PrefService::IsSyncing() changes. 283 // PrefService::IsSyncing() changes.
284 prefs->AddObserver(this); 284 prefs->AddObserver(this);
285 } 285 }
286 ash::Shell::GetInstance()->AddShellObserver(this); 286 ash::Shell::GetInstance()->AddShellObserver(this);
287 } 287 }
288 } 288 }
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest( 1190 void ChromeLauncherControllerPerBrowser::SetAppIconLoaderForTest(
1191 AppIconLoader* loader) { 1191 AppIconLoader* loader) {
1192 app_icon_loader_.reset(loader); 1192 app_icon_loader_.reset(loader);
1193 } 1193 }
1194 1194
1195 const std::string& 1195 const std::string&
1196 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest( 1196 ChromeLauncherControllerPerBrowser::GetAppIdFromLauncherIdForTest(
1197 ash::LauncherID id) { 1197 ash::LauncherID id) {
1198 return id_to_item_controller_map_[id]->app_id(); 1198 return id_to_item_controller_map_[id]->app_id();
1199 } 1199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698