OLD | NEW |
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 #include "chrome/browser/search_engines/search_provider_install_data.h" | 5 #include "chrome/browser/search_engines/search_provider_install_data.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 base::Passed(template_url_copies.Pass()), | 53 base::Passed(template_url_copies.Pass()), |
54 base::Unretained(default_provider_copy))); | 54 base::Unretained(default_provider_copy))); |
55 } | 55 } |
56 | 56 |
57 // Implementation of SearchTermsData that may be used on the I/O thread. | 57 // Implementation of SearchTermsData that may be used on the I/O thread. |
58 class IOThreadSearchTermsData : public SearchTermsData { | 58 class IOThreadSearchTermsData : public SearchTermsData { |
59 public: | 59 public: |
60 explicit IOThreadSearchTermsData(const std::string& google_base_url); | 60 explicit IOThreadSearchTermsData(const std::string& google_base_url); |
61 | 61 |
62 // Implementation of SearchTermsData. | 62 // Implementation of SearchTermsData. |
63 virtual std::string GoogleBaseURLValue() const override; | 63 std::string GoogleBaseURLValue() const override; |
64 | 64 |
65 private: | 65 private: |
66 std::string google_base_url_; | 66 std::string google_base_url_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(IOThreadSearchTermsData); | 68 DISALLOW_COPY_AND_ASSIGN(IOThreadSearchTermsData); |
69 }; | 69 }; |
70 | 70 |
71 IOThreadSearchTermsData::IOThreadSearchTermsData( | 71 IOThreadSearchTermsData::IOThreadSearchTermsData( |
72 const std::string& google_base_url) : google_base_url_(google_base_url) { | 72 const std::string& google_base_url) : google_base_url_(google_base_url) { |
73 } | 73 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 // Notices changes in the Google base URL and sends them along | 115 // Notices changes in the Google base URL and sends them along |
116 // to the SearchProviderInstallData on the I/O thread. | 116 // to the SearchProviderInstallData on the I/O thread. |
117 class GoogleURLObserver : public content::RenderProcessHostObserver { | 117 class GoogleURLObserver : public content::RenderProcessHostObserver { |
118 public: | 118 public: |
119 GoogleURLObserver(GoogleURLTracker* google_url_tracker, | 119 GoogleURLObserver(GoogleURLTracker* google_url_tracker, |
120 GoogleURLChangeNotifier* change_notifier, | 120 GoogleURLChangeNotifier* change_notifier, |
121 content::RenderProcessHost* host); | 121 content::RenderProcessHost* host); |
122 | 122 |
123 // Implementation of content::RenderProcessHostObserver. | 123 // Implementation of content::RenderProcessHostObserver. |
124 virtual void RenderProcessHostDestroyed( | 124 void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; |
125 content::RenderProcessHost* host) override; | |
126 | 125 |
127 private: | 126 private: |
128 virtual ~GoogleURLObserver() {} | 127 ~GoogleURLObserver() override {} |
129 | 128 |
130 // Callback that is called when the Google URL is updated. | 129 // Callback that is called when the Google URL is updated. |
131 void OnGoogleURLUpdated(); | 130 void OnGoogleURLUpdated(); |
132 | 131 |
133 GoogleURLTracker* google_url_tracker_; | 132 GoogleURLTracker* google_url_tracker_; |
134 scoped_refptr<GoogleURLChangeNotifier> change_notifier_; | 133 scoped_refptr<GoogleURLChangeNotifier> change_notifier_; |
135 | 134 |
136 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; | 135 scoped_ptr<GoogleURLTracker::Subscription> google_url_updated_subscription_; |
137 | 136 |
138 DISALLOW_COPY_AND_ASSIGN(GoogleURLObserver); | 137 DISALLOW_COPY_AND_ASSIGN(GoogleURLObserver); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 308 |
310 std::for_each(closure_queue.begin(), | 309 std::for_each(closure_queue.begin(), |
311 closure_queue.end(), | 310 closure_queue.end(), |
312 std::mem_fun_ref(&base::Closure::Run)); | 311 std::mem_fun_ref(&base::Closure::Run)); |
313 | 312 |
314 // Since we expect this request to be rare, clear out the information. This | 313 // Since we expect this request to be rare, clear out the information. This |
315 // also keeps the responses current as the search providers change. | 314 // also keeps the responses current as the search providers change. |
316 provider_map_.reset(); | 315 provider_map_.reset(); |
317 SetDefault(NULL); | 316 SetDefault(NULL); |
318 } | 317 } |
OLD | NEW |