OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/message_loop_helpers.h" |
15 #include "chrome/browser/search_engines/search_host_to_urls_map.h" | 16 #include "chrome/browser/search_engines/search_host_to_urls_map.h" |
16 #include "chrome/browser/search_engines/search_terms_data.h" | 17 #include "chrome/browser/search_engines/search_terms_data.h" |
17 #include "chrome/browser/search_engines/template_url.h" | 18 #include "chrome/browser/search_engines/template_url.h" |
18 #include "chrome/browser/search_engines/template_url_service.h" | 19 #include "chrome/browser/search_engines/template_url_service.h" |
19 #include "chrome/browser/search_engines/util.h" | 20 #include "chrome/browser/search_engines/util.h" |
20 #include "chrome/browser/webdata/web_data_service.h" | 21 #include "chrome/browser/webdata/web_data_service.h" |
21 #include "chrome/common/chrome_notification_types.h" | 22 #include "chrome/common/chrome_notification_types.h" |
22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/notification_observer.h" | 24 #include "content/public/browser/notification_observer.h" |
24 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 public: | 75 public: |
75 explicit GoogleURLChangeNotifier( | 76 explicit GoogleURLChangeNotifier( |
76 const base::WeakPtr<SearchProviderInstallData>& install_data); | 77 const base::WeakPtr<SearchProviderInstallData>& install_data); |
77 | 78 |
78 // Called on the I/O thread with the Google base URL whenever the value | 79 // Called on the I/O thread with the Google base URL whenever the value |
79 // changes. | 80 // changes. |
80 void OnChange(const std::string& google_base_url); | 81 void OnChange(const std::string& google_base_url); |
81 | 82 |
82 private: | 83 private: |
83 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 84 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
84 friend class DeleteTask<GoogleURLChangeNotifier>; | 85 friend class base::DeleteHelper<GoogleURLChangeNotifier>; |
85 | 86 |
86 ~GoogleURLChangeNotifier() {} | 87 ~GoogleURLChangeNotifier() {} |
87 | 88 |
88 base::WeakPtr<SearchProviderInstallData> install_data_; | 89 base::WeakPtr<SearchProviderInstallData> install_data_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(GoogleURLChangeNotifier); | 91 DISALLOW_COPY_AND_ASSIGN(GoogleURLChangeNotifier); |
91 }; | 92 }; |
92 | 93 |
93 GoogleURLChangeNotifier::GoogleURLChangeNotifier( | 94 GoogleURLChangeNotifier::GoogleURLChangeNotifier( |
94 const base::WeakPtr<SearchProviderInstallData>& install_data) | 95 const base::WeakPtr<SearchProviderInstallData>& install_data) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 307 |
307 std::for_each(closure_queue.begin(), | 308 std::for_each(closure_queue.begin(), |
308 closure_queue.end(), | 309 closure_queue.end(), |
309 std::mem_fun_ref(&base::Closure::Run)); | 310 std::mem_fun_ref(&base::Closure::Run)); |
310 | 311 |
311 // Since we expect this request to be rare, clear out the information. This | 312 // Since we expect this request to be rare, clear out the information. This |
312 // also keeps the responses current as the search providers change. | 313 // also keeps the responses current as the search providers change. |
313 provider_map_.reset(); | 314 provider_map_.reset(); |
314 SetDefault(NULL); | 315 SetDefault(NULL); |
315 } | 316 } |
OLD | NEW |