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

Side by Side Diff: athena/extensions/shell/url_search_provider.cc

Issue 641683003: C++11 override style change for athena (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 6 years, 2 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 #include "athena/extensions/shell/url_search_provider.h" 5 #include "athena/extensions/shell/url_search_provider.h"
6 6
7 #include "athena/activity/public/activity.h" 7 #include "athena/activity/public/activity.h"
8 #include "athena/activity/public/activity_factory.h" 8 #include "athena/activity/public/activity_factory.h"
9 #include "athena/extensions/shell/athena_shell_scheme_classifier.h" 9 #include "athena/extensions/shell/athena_shell_scheme_classifier.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 25 matching lines...) Expand all
36 // SearchTermsData: 36 // SearchTermsData:
37 virtual std::string GetSuggestClient() const override { return "chrome"; } 37 virtual std::string GetSuggestClient() const override { return "chrome"; }
38 }; 38 };
39 39
40 // The templateURLServiceClient for Athena. Mainly for the interaction with 40 // The templateURLServiceClient for Athena. Mainly for the interaction with
41 // history module (see chrome/browser/search_engines for Chrome implementation). 41 // history module (see chrome/browser/search_engines for Chrome implementation).
42 // TODO(mukai): Implement the contents of this class when it's necessary. 42 // TODO(mukai): Implement the contents of this class when it's necessary.
43 class AthenaTemplateURLServiceClient : public TemplateURLServiceClient { 43 class AthenaTemplateURLServiceClient : public TemplateURLServiceClient {
44 public: 44 public:
45 AthenaTemplateURLServiceClient() {} 45 AthenaTemplateURLServiceClient() {}
46 virtual ~AthenaTemplateURLServiceClient() {} 46 ~AthenaTemplateURLServiceClient() override {}
47 47
48 private: 48 private:
49 // TemplateURLServiceClient: 49 // TemplateURLServiceClient:
50 virtual void Shutdown() override {} 50 void Shutdown() override {}
51 virtual void SetOwner(TemplateURLService* owner) override {} 51 void SetOwner(TemplateURLService* owner) override {}
52 virtual void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {} 52 void DeleteAllSearchTermsForKeyword(TemplateURLID id) override {}
53 virtual void SetKeywordSearchTermsForURL( 53 void SetKeywordSearchTermsForURL(const GURL& url,
54 const GURL& url, 54 TemplateURLID id,
55 TemplateURLID id, 55 const base::string16& term) override {}
56 const base::string16& term) override {} 56 void AddKeywordGeneratedVisit(const GURL& url) override {}
57 virtual void AddKeywordGeneratedVisit(const GURL& url) override {} 57 void RestoreExtensionInfoIfNecessary(TemplateURL* template_url) override {}
58 virtual void RestoreExtensionInfoIfNecessary(
59 TemplateURL* template_url) override {}
60 58
61 DISALLOW_COPY_AND_ASSIGN(AthenaTemplateURLServiceClient); 59 DISALLOW_COPY_AND_ASSIGN(AthenaTemplateURLServiceClient);
62 }; 60 };
63 61
64 // The AutocompleteProviderClient for Athena. 62 // The AutocompleteProviderClient for Athena.
65 class AthenaAutocompleteProviderClient : public AutocompleteProviderClient { 63 class AthenaAutocompleteProviderClient : public AutocompleteProviderClient {
66 public: 64 public:
67 explicit AthenaAutocompleteProviderClient( 65 explicit AthenaAutocompleteProviderClient(
68 content::BrowserContext* browser_context) 66 content::BrowserContext* browser_context)
69 : browser_context_(browser_context) {} 67 : browser_context_(browser_context) {}
70 virtual ~AthenaAutocompleteProviderClient() {} 68 ~AthenaAutocompleteProviderClient() override {}
71 69
72 virtual net::URLRequestContextGetter* RequestContext() override { 70 net::URLRequestContextGetter* RequestContext() override {
73 return browser_context_->GetRequestContext(); 71 return browser_context_->GetRequestContext();
74 } 72 }
75 virtual bool IsOffTheRecord() override { 73 bool IsOffTheRecord() override { return browser_context_->IsOffTheRecord(); }
76 return browser_context_->IsOffTheRecord(); 74 std::string AcceptLanguages() override {
77 }
78 virtual std::string AcceptLanguages() override {
79 // TODO(hashimoto): Return the value stored in the prefs. 75 // TODO(hashimoto): Return the value stored in the prefs.
80 return "en-US"; 76 return "en-US";
81 } 77 }
82 virtual bool SearchSuggestEnabled() override { return true; } 78 bool SearchSuggestEnabled() override { return true; }
83 virtual bool ShowBookmarkBar() override { return false; } 79 bool ShowBookmarkBar() override { return false; }
84 virtual const AutocompleteSchemeClassifier& SchemeClassifier() override { 80 const AutocompleteSchemeClassifier& SchemeClassifier() override {
85 return scheme_classifier_; 81 return scheme_classifier_;
86 } 82 }
87 virtual void Classify( 83 void Classify(
88 const base::string16& text, 84 const base::string16& text,
89 bool prefer_keyword, 85 bool prefer_keyword,
90 bool allow_exact_keyword_match, 86 bool allow_exact_keyword_match,
91 metrics::OmniboxEventProto::PageClassification page_classification, 87 metrics::OmniboxEventProto::PageClassification page_classification,
92 AutocompleteMatch* match, 88 AutocompleteMatch* match,
93 GURL* alternate_nav_url) override {} 89 GURL* alternate_nav_url) override {}
94 virtual history::URLDatabase* InMemoryDatabase() override { return nullptr; } 90 history::URLDatabase* InMemoryDatabase() override { return nullptr; }
95 virtual void DeleteMatchingURLsForKeywordFromHistory( 91 void DeleteMatchingURLsForKeywordFromHistory(
96 history::KeywordID keyword_id, 92 history::KeywordID keyword_id,
97 const base::string16& term) override {} 93 const base::string16& term) override {}
98 virtual bool TabSyncEnabledAndUnencrypted() override { return false; } 94 bool TabSyncEnabledAndUnencrypted() override { return false; }
99 virtual void PrefetchImage(const GURL& url) override {} 95 void PrefetchImage(const GURL& url) override {}
100 96
101 private: 97 private:
102 content::BrowserContext* browser_context_; 98 content::BrowserContext* browser_context_;
103 AthenaShellSchemeClassifier scheme_classifier_; 99 AthenaShellSchemeClassifier scheme_classifier_;
104 100
105 DISALLOW_COPY_AND_ASSIGN(AthenaAutocompleteProviderClient); 101 DISALLOW_COPY_AND_ASSIGN(AthenaAutocompleteProviderClient);
106 }; 102 };
107 103
108 int ACMatchStyleToTagStyle(int styles) { 104 int ACMatchStyleToTagStyle(int styles) {
109 int tag_styles = 0; 105 int tag_styles = 0;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 152
157 // Derive relevance from omnibox relevance and normalize it to [0, 1]. 153 // Derive relevance from omnibox relevance and normalize it to [0, 1].
158 // The magic number 1500 is the highest score of an omnibox result. 154 // The magic number 1500 is the highest score of an omnibox result.
159 // See comments in autocomplete_provider.h. 155 // See comments in autocomplete_provider.h.
160 set_relevance(match_.relevance / 1500.0); 156 set_relevance(match_.relevance / 1500.0);
161 157
162 UpdateIcon(); 158 UpdateIcon();
163 UpdateTitleAndDetails(); 159 UpdateTitleAndDetails();
164 } 160 }
165 161
166 virtual ~UrlSearchResult() {} 162 ~UrlSearchResult() override {}
167 163
168 private: 164 private:
169 // Overridden from app_list::SearchResult: 165 // Overridden from app_list::SearchResult:
170 virtual scoped_ptr<app_list::SearchResult> Duplicate() override { 166 scoped_ptr<app_list::SearchResult> Duplicate() override {
171 return make_scoped_ptr(new UrlSearchResult(browser_context_, match_)); 167 return make_scoped_ptr(new UrlSearchResult(browser_context_, match_));
172 } 168 }
173 169
174 virtual void Open(int event_flags) override { 170 void Open(int event_flags) override {
175 Activity* activity = ActivityFactory::Get()->CreateWebActivity( 171 Activity* activity = ActivityFactory::Get()->CreateWebActivity(
176 browser_context_, base::string16(), match_.destination_url); 172 browser_context_, base::string16(), match_.destination_url);
177 Activity::Show(activity); 173 Activity::Show(activity);
178 } 174 }
179 175
180 void UpdateIcon() { 176 void UpdateIcon() {
181 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 177 SetIcon(*ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
182 AutocompleteMatch::TypeToIcon(match_.type))); 178 AutocompleteMatch::TypeToIcon(match_.type)));
183 } 179 }
184 180
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 ++it) { 268 ++it) {
273 if (!it->destination_url.is_valid()) 269 if (!it->destination_url.is_valid())
274 continue; 270 continue;
275 271
276 Add(scoped_ptr<app_list::SearchResult>( 272 Add(scoped_ptr<app_list::SearchResult>(
277 new UrlSearchResult(browser_context_, *it))); 273 new UrlSearchResult(browser_context_, *it)));
278 } 274 }
279 } 275 }
280 276
281 } // namespace athena 277 } // namespace athena
OLDNEW
« no previous file with comments | « athena/extensions/shell/url_search_provider.h ('k') | athena/extensions/test/test_extensions_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698