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

Side by Side Diff: components/search_engines/template_url.h

Issue 2814743006: Refactoring after comments in https://codereview.chromium.org/2639153002 (Closed)
Patch Set: Fixed after review, round 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 NORMAL_CONTROLLED_BY_EXTENSION, 475 NORMAL_CONTROLLED_BY_EXTENSION,
476 // The keyword associated with an extension that uses the Omnibox API. 476 // The keyword associated with an extension that uses the Omnibox API.
477 OMNIBOX_API_EXTENSION, 477 OMNIBOX_API_EXTENSION,
478 // Installed only on this device. Should not be synced. 478 // Installed only on this device. Should not be synced.
479 LOCAL, 479 LOCAL,
480 }; 480 };
481 481
482 // An AssociatedExtensionInfo represents information about the extension that 482 // An AssociatedExtensionInfo represents information about the extension that
483 // added the search engine. 483 // added the search engine.
484 struct AssociatedExtensionInfo { 484 struct AssociatedExtensionInfo {
485 explicit AssociatedExtensionInfo(const std::string& extension_id); 485 AssociatedExtensionInfo(const std::string& extension_id,
486 base::Time install_time,
487 bool wants_to_be_default_engine);
486 ~AssociatedExtensionInfo(); 488 ~AssociatedExtensionInfo();
487 489
488 std::string extension_id; 490 std::string extension_id;
489 491
490 // Whether the search engine is supposed to be default.
491 bool wants_to_be_default_engine;
492
493 // Used to resolve conflicts when there are multiple extensions specifying 492 // Used to resolve conflicts when there are multiple extensions specifying
494 // the default search engine. The most recently-installed wins. 493 // the default search engine. The most recently-installed wins.
495 base::Time install_time; 494 base::Time install_time;
495
496 // Whether the search engine is supposed to be default.
497 bool wants_to_be_default_engine;
496 }; 498 };
497 499
498 explicit TemplateURL(const TemplateURLData& data, Type type = NORMAL); 500 explicit TemplateURL(const TemplateURLData& data, Type type = NORMAL);
501
502 // Constructor for extension controlled engine. |type| must be
503 // NORMAL_CONTROLLED_BY_EXTENSION or OMNIBOX_API_EXTENSION.
504 TemplateURL(const TemplateURLData& data,
505 Type type,
506 std::string extension_id,
507 base::Time install_time,
508 bool wants_to_be_default_engine);
509
499 ~TemplateURL(); 510 ~TemplateURL();
500 511
501 // Generates a suitable keyword for the specified url, which must be valid. 512 // Generates a suitable keyword for the specified url, which must be valid.
502 // This is guaranteed not to return an empty string, since TemplateURLs should 513 // This is guaranteed not to return an empty string, since TemplateURLs should
503 // never have an empty keyword. 514 // never have an empty keyword.
504 static base::string16 GenerateKeyword(const GURL& url); 515 static base::string16 GenerateKeyword(const GURL& url);
505 516
506 // Generates a favicon URL from the specified url. 517 // Generates a favicon URL from the specified url.
507 static GURL GenerateFaviconURL(const GURL& url); 518 static GURL GenerateFaviconURL(const GURL& url);
508 519
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 744
734 // Caches the computed engine type across successive calls to GetEngineType(). 745 // Caches the computed engine type across successive calls to GetEngineType().
735 mutable SearchEngineType engine_type_; 746 mutable SearchEngineType engine_type_;
736 747
737 // TODO(sky): Add date last parsed OSD file. 748 // TODO(sky): Add date last parsed OSD file.
738 749
739 DISALLOW_COPY_AND_ASSIGN(TemplateURL); 750 DISALLOW_COPY_AND_ASSIGN(TemplateURL);
740 }; 751 };
741 752
742 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_ 753 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_H_
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_service_unittest.cc ('k') | components/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698