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

Side by Side Diff: chrome/browser/search_engines/template_url_service.h

Issue 10033017: More misc. cleanups to minimize future refactoring diffs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 399
400 // Returns true if the TemplateURL is replaceable. This doesn't look at the 400 // Returns true if the TemplateURL is replaceable. This doesn't look at the
401 // uniqueness of the keyword or host and is intended to be called after those 401 // uniqueness of the keyword or host and is intended to be called after those
402 // checks have been done. This returns true if the TemplateURL doesn't appear 402 // checks have been done. This returns true if the TemplateURL doesn't appear
403 // in the default list and is marked as safe_for_autoreplace. 403 // in the default list and is marked as safe_for_autoreplace.
404 bool CanReplace(const TemplateURL* t_url); 404 bool CanReplace(const TemplateURL* t_url);
405 405
406 // Updates the information in |existing_turl| using the information from 406 // Updates the information in |existing_turl| using the information from
407 // |new_values|, but the ID for |existing_turl| is retained. 407 // |new_values|, but the ID for |existing_turl| is retained.
408 // Notifying observers is the responsibility of the caller. 408 // Notifying observers is the responsibility of the caller.
409 // NOTE: This should not be called with an extension keyword as there are no
410 // updates needed in that case.
409 void UpdateNoNotify(const TemplateURL* existing_turl, 411 void UpdateNoNotify(const TemplateURL* existing_turl,
410 const TemplateURL& new_values); 412 const TemplateURL& new_values);
411 413
412 // Returns the preferences we use. 414 // Returns the preferences we use.
413 PrefService* GetPrefs(); 415 PrefService* GetPrefs();
414 416
415 // Iterates through the TemplateURLs to see if one matches the visited url. 417 // Iterates through the TemplateURLs to see if one matches the visited url.
416 // For each TemplateURL whose url matches the visited url 418 // For each TemplateURL whose url matches the visited url
417 // SetKeywordSearchTermsForURL is invoked. 419 // SetKeywordSearchTermsForURL is invoked.
418 void UpdateKeywordSearchTermsForURL( 420 void UpdateKeywordSearchTermsForURL(
(...skipping 18 matching lines...) Expand all
437 // Update the default search. Called at initialization or when a managed 439 // Update the default search. Called at initialization or when a managed
438 // preference has changed. 440 // preference has changed.
439 void UpdateDefaultSearch(); 441 void UpdateDefaultSearch();
440 442
441 // Set the default search provider even if it is managed. |url| may be null. 443 // Set the default search provider even if it is managed. |url| may be null.
442 // Caller is responsible for notifying observers. 444 // Caller is responsible for notifying observers.
443 void SetDefaultSearchProviderNoNotify(const TemplateURL* url); 445 void SetDefaultSearchProviderNoNotify(const TemplateURL* url);
444 446
445 // Adds a new TemplateURL to this model. TemplateURLService will own the 447 // Adds a new TemplateURL to this model. TemplateURLService will own the
446 // reference, and delete it when the TemplateURL is removed. 448 // reference, and delete it when the TemplateURL is removed.
449 // If |newly_adding| is false, we assume that this TemplateURL was already
450 // part of the model in the past, and therefore we don't need to do things
451 // like assign it an ID or notify sync.
447 // Caller is responsible for notifying observers. 452 // Caller is responsible for notifying observers.
448 void AddNoNotify(TemplateURL* template_url); 453 void AddNoNotify(TemplateURL* template_url, bool newly_adding);
449 454
450 // Removes the keyword from the model. This deletes the supplied TemplateURL. 455 // Removes the keyword from the model. This deletes the supplied TemplateURL.
451 // This fails if the supplied template_url is the default search provider. 456 // This fails if the supplied template_url is the default search provider.
452 // Caller is responsible for notifying observers. 457 // Caller is responsible for notifying observers.
453 void RemoveNoNotify(const TemplateURL* template_url); 458 void RemoveNoNotify(const TemplateURL* template_url);
454 459
455 // Notify the observers that the model has changed. This is done only if the 460 // Notify the observers that the model has changed. This is done only if the
456 // model is loaded. 461 // model is loaded.
457 void NotifyObservers(); 462 void NotifyObservers();
458 463
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 // from Sync. This is to facilitate the fact that changes to the value of 599 // from Sync. This is to facilitate the fact that changes to the value of
595 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the 600 // prefs::kSyncedDefaultSearchProviderGUID do not always come before the
596 // TemplateURL entry it refers to, and to handle the case when we want to use 601 // TemplateURL entry it refers to, and to handle the case when we want to use
597 // the Synced default when the default search provider becomes unmanaged. 602 // the Synced default when the default search provider becomes unmanaged.
598 bool pending_synced_default_search_; 603 bool pending_synced_default_search_;
599 604
600 DISALLOW_COPY_AND_ASSIGN(TemplateURLService); 605 DISALLOW_COPY_AND_ASSIGN(TemplateURLService);
601 }; 606 };
602 607
603 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_ 608 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698