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

Side by Side Diff: chrome/browser/search_engines/search_provider_install_data.cc

Issue 10458077: When the Google base URL changes and causes keyword updates, save those to the database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
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
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 "base/message_loop_helpers.h"
16 #include "chrome/browser/google/google_url_tracker.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/search_engines/search_host_to_urls_map.h" 18 #include "chrome/browser/search_engines/search_host_to_urls_map.h"
18 #include "chrome/browser/search_engines/search_terms_data.h" 19 #include "chrome/browser/search_engines/search_terms_data.h"
19 #include "chrome/browser/search_engines/template_url.h" 20 #include "chrome/browser/search_engines/template_url.h"
20 #include "chrome/browser/search_engines/template_url_service.h" 21 #include "chrome/browser/search_engines/template_url_service.h"
21 #include "chrome/browser/search_engines/util.h" 22 #include "chrome/browser/search_engines/util.h"
22 #include "chrome/browser/webdata/web_data_service.h" 23 #include "chrome/browser/webdata/web_data_service.h"
23 #include "chrome/browser/webdata/web_data_service_factory.h" 24 #include "chrome/browser/webdata/web_data_service_factory.h"
24 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 content::Source<Profile>(profile->GetOriginalProfile())); 127 content::Source<Profile>(profile->GetOriginalProfile()));
127 registrar_.Add(this, ui_death_notification, ui_death_source); 128 registrar_.Add(this, ui_death_notification, ui_death_source);
128 } 129 }
129 130
130 void GoogleURLObserver::Observe(int type, 131 void GoogleURLObserver::Observe(int type,
131 const content::NotificationSource& source, 132 const content::NotificationSource& source,
132 const content::NotificationDetails& details) { 133 const content::NotificationDetails& details) {
133 if (type == chrome::NOTIFICATION_GOOGLE_URL_UPDATED) { 134 if (type == chrome::NOTIFICATION_GOOGLE_URL_UPDATED) {
134 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 135 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
135 base::Bind(&GoogleURLChangeNotifier::OnChange, change_notifier_.get(), 136 base::Bind(&GoogleURLChangeNotifier::OnChange, change_notifier_.get(),
136 content::Details<const GURL>(details)->spec())); 137 content::Details<GoogleURLTracker::UpdatedDetails>(details)->second.
138 spec()));
137 } else { 139 } else {
138 // This must be the death notification. 140 // This must be the death notification.
139 delete this; 141 delete this;
140 } 142 }
141 } 143 }
142 144
143 // Indicates if the two inputs have the same security origin. 145 // Indicates if the two inputs have the same security origin.
144 // |requested_origin| should only be a security origin (no path, etc.). 146 // |requested_origin| should only be a security origin (no path, etc.).
145 // It is ok if |template_url| is NULL. 147 // It is ok if |template_url| is NULL.
146 static bool IsSameOrigin(const GURL& requested_origin, 148 static bool IsSameOrigin(const GURL& requested_origin,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 298
297 std::for_each(closure_queue.begin(), 299 std::for_each(closure_queue.begin(),
298 closure_queue.end(), 300 closure_queue.end(),
299 std::mem_fun_ref(&base::Closure::Run)); 301 std::mem_fun_ref(&base::Closure::Run));
300 302
301 // 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
302 // also keeps the responses current as the search providers change. 304 // also keeps the responses current as the search providers change.
303 provider_map_.reset(); 305 provider_map_.reset();
304 SetDefault(NULL); 306 SetDefault(NULL);
305 } 307 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/search_host_to_urls_map_unittest.cc ('k') | chrome/browser/search_engines/template_url.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698