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

Side by Side Diff: chrome/browser/profile_resetter/resettable_settings_snapshot.cc

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 months 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/profile_resetter/resettable_settings_snapshot.h" 5 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 PrefService* prefs = profile->GetPrefs(); 58 PrefService* prefs = profile->GetPrefs();
59 DCHECK(prefs); 59 DCHECK(prefs);
60 homepage_ = prefs->GetString(prefs::kHomePage); 60 homepage_ = prefs->GetString(prefs::kHomePage);
61 homepage_is_ntp_ = prefs->GetBoolean(prefs::kHomePageIsNewTabPage); 61 homepage_is_ntp_ = prefs->GetBoolean(prefs::kHomePageIsNewTabPage);
62 show_home_button_ = prefs->GetBoolean(prefs::kShowHomeButton); 62 show_home_button_ = prefs->GetBoolean(prefs::kShowHomeButton);
63 63
64 TemplateURLService* service = 64 TemplateURLService* service =
65 TemplateURLServiceFactory::GetForProfile(profile); 65 TemplateURLServiceFactory::GetForProfile(profile);
66 DCHECK(service); 66 DCHECK(service);
67 TemplateURL* dse = service->GetDefaultSearchProvider(); 67 const TemplateURL* dse = service->GetDefaultSearchProvider();
68 if (dse) 68 if (dse)
69 dse_url_ = dse->url(); 69 dse_url_ = dse->url();
70 70
71 const extensions::ExtensionSet& enabled_ext = 71 const extensions::ExtensionSet& enabled_ext =
72 extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); 72 extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
73 enabled_extensions_.reserve(enabled_ext.size()); 73 enabled_extensions_.reserve(enabled_ext.size());
74 74
75 for (extensions::ExtensionSet::const_iterator it = enabled_ext.begin(); 75 for (extensions::ExtensionSet::const_iterator it = enabled_ext.begin();
76 it != enabled_ext.end(); ++it) 76 it != enabled_ext.end(); ++it)
77 enabled_extensions_.push_back(std::make_pair((*it)->id(), (*it)->name())); 77 enabled_extensions_.push_back(std::make_pair((*it)->id(), (*it)->name()));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 ? IDS_RESET_PROFILE_SETTINGS_YES 285 ? IDS_RESET_PROFILE_SETTINGS_YES
286 : IDS_RESET_PROFILE_SETTINGS_NO; 286 : IDS_RESET_PROFILE_SETTINGS_NO;
287 AddPair( 287 AddPair(
288 list.get(), 288 list.get(),
289 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON), 289 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_SHOW_HOME_BUTTON),
290 l10n_util::GetStringUTF16(show_home_button_id)); 290 l10n_util::GetStringUTF16(show_home_button_id));
291 291
292 TemplateURLService* service = 292 TemplateURLService* service =
293 TemplateURLServiceFactory::GetForProfile(profile); 293 TemplateURLServiceFactory::GetForProfile(profile);
294 DCHECK(service); 294 DCHECK(service);
295 TemplateURL* dse = service->GetDefaultSearchProvider(); 295 const TemplateURL* dse = service->GetDefaultSearchProvider();
296 if (dse) { 296 if (dse) {
297 AddPair(list.get(), 297 AddPair(list.get(),
298 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_DSE), 298 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_DSE),
299 dse->GenerateSearchURL(service->search_terms_data()).host()); 299 dse->GenerateSearchURL(service->search_terms_data()).host());
300 } 300 }
301 301
302 if (snapshot.shortcuts_determined()) { 302 if (snapshot.shortcuts_determined()) {
303 base::string16 shortcut_targets; 303 base::string16 shortcut_targets;
304 const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts(); 304 const std::vector<ShortcutCommand>& shortcuts = snapshot.shortcuts();
305 for (std::vector<ShortcutCommand>::const_iterator i = 305 for (std::vector<ShortcutCommand>::const_iterator i =
(...skipping 24 matching lines...) Expand all
330 extension_names += '\n'; 330 extension_names += '\n';
331 extension_names += i->second; 331 extension_names += i->second;
332 } 332 }
333 if (!extension_names.empty()) { 333 if (!extension_names.empty()) {
334 AddPair(list.get(), 334 AddPair(list.get(),
335 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), 335 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS),
336 extension_names); 336 extension_names);
337 } 337 }
338 return list; 338 return list;
339 } 339 }
OLDNEW
« no previous file with comments | « chrome/browser/profile_resetter/profile_resetter_unittest.cc ('k') | chrome/browser/search/search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698