OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 std::string IOThreadSearchTermsData::GetApplicationLocale() const { | 59 std::string IOThreadSearchTermsData::GetApplicationLocale() const { |
60 // This value doesn't matter for our purposes. | 60 // This value doesn't matter for our purposes. |
61 return "yy"; | 61 return "yy"; |
62 } | 62 } |
63 | 63 |
64 // Handles telling SearchProviderInstallData about changes to the google base | 64 // Handles telling SearchProviderInstallData about changes to the google base |
65 // url. (Ensure that this is deleted on the I/O thread so that the WeakPtr is | 65 // url. (Ensure that this is deleted on the I/O thread so that the WeakPtr is |
66 // deleted on the correct thread.) | 66 // deleted on the correct thread.) |
67 class GoogleURLChangeNotifier | 67 class GoogleURLChangeNotifier |
68 : public base::RefCountedThreadSafe<GoogleURLChangeNotifier, | 68 : public base::RefCountedThreadSafe<GoogleURLChangeNotifier, |
69 ChromeThread::DeleteOnIOThread> { | 69 BrowserThread::DeleteOnIOThread> { |
70 public: | 70 public: |
71 explicit GoogleURLChangeNotifier( | 71 explicit GoogleURLChangeNotifier( |
72 const base::WeakPtr<SearchProviderInstallData>& install_data); | 72 const base::WeakPtr<SearchProviderInstallData>& install_data); |
73 | 73 |
74 // Called on the I/O thread with the Google base URL whenever the value | 74 // Called on the I/O thread with the Google base URL whenever the value |
75 // changes. | 75 // changes. |
76 void OnChange(const std::string& google_base_url); | 76 void OnChange(const std::string& google_base_url); |
77 | 77 |
78 private: | 78 private: |
79 friend struct ChromeThread::DeleteOnThread<ChromeThread::IO>; | 79 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
80 friend class DeleteTask<GoogleURLChangeNotifier>; | 80 friend class DeleteTask<GoogleURLChangeNotifier>; |
81 | 81 |
82 ~GoogleURLChangeNotifier() {} | 82 ~GoogleURLChangeNotifier() {} |
83 | 83 |
84 base::WeakPtr<SearchProviderInstallData> install_data_; | 84 base::WeakPtr<SearchProviderInstallData> install_data_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(GoogleURLChangeNotifier); | 86 DISALLOW_COPY_AND_ASSIGN(GoogleURLChangeNotifier); |
87 }; | 87 }; |
88 | 88 |
89 GoogleURLChangeNotifier::GoogleURLChangeNotifier( | 89 GoogleURLChangeNotifier::GoogleURLChangeNotifier( |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 void SearchProviderInstallData::NotifyLoaded() { | 298 void SearchProviderInstallData::NotifyLoaded() { |
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
300 | 300 |
301 task_queue_.Run(); | 301 task_queue_.Run(); |
302 | 302 |
303 // Since we expect this request to be rare, clear out the information. This | 303 // Since we expect this request to be rare, clear out the information. This |
304 // also keeps the responses current as the search providers change. | 304 // also keeps the responses current as the search providers change. |
305 provider_map_.reset(); | 305 provider_map_.reset(); |
306 SetDefault(NULL); | 306 SetDefault(NULL); |
307 } | 307 } |
OLD | NEW |