| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |