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

Side by Side Diff: chrome/browser/ui/search_engines/search_engine_tab_helper.cc

Issue 10993064: Make using WebContentsUserData simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | 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/ui/search_engines/search_engine_tab_helper.h" 5 #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search_engines/template_url.h" 8 #include "chrome/browser/search_engines/template_url.h"
9 #include "chrome/browser/search_engines/template_url_fetcher.h" 9 #include "chrome/browser/search_engines/template_url_fetcher.h"
10 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" 10 #include "chrome/browser/search_engines/template_url_fetcher_factory.h"
11 #include "chrome/browser/search_engines/template_url_service.h" 11 #include "chrome/browser/search_engines/template_url_service.h"
12 #include "chrome/browser/search_engines/template_url_service_factory.h" 12 #include "chrome/browser/search_engines/template_url_service_factory.h"
13 #include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h" 13 #include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h"
14 #include "chrome/common/render_messages.h" 14 #include "chrome/common/render_messages.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "content/public/browser/favicon_status.h" 16 #include "content/public/browser/favicon_status.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
20 #include "content/public/common/frame_navigate_params.h" 20 #include "content/public/common/frame_navigate_params.h"
21 21
22 using content::NavigationController; 22 using content::NavigationController;
23 using content::NavigationEntry; 23 using content::NavigationEntry;
24 using content::WebContents; 24 using content::WebContents;
25 25
26 int SearchEngineTabHelper::kUserDataKey; 26 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SearchEngineTabHelper)
27 27
28 namespace { 28 namespace {
29 29
30 // Returns true if the entry's transition type is FORM_SUBMIT. 30 // Returns true if the entry's transition type is FORM_SUBMIT.
31 bool IsFormSubmit(const NavigationEntry* entry) { 31 bool IsFormSubmit(const NavigationEntry* entry) {
32 return (content::PageTransitionStripQualifier(entry->GetTransitionType()) == 32 return (content::PageTransitionStripQualifier(entry->GetTransitionType()) ==
33 content::PAGE_TRANSITION_FORM_SUBMIT); 33 content::PAGE_TRANSITION_FORM_SUBMIT);
34 } 34 }
35 35
36 string16 GenerateKeywordFromNavigationEntry(const NavigationEntry* entry) { 36 string16 GenerateKeywordFromNavigationEntry(const NavigationEntry* entry) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 // the favicon url wasn't obtained before the load started. This assumes the 194 // the favicon url wasn't obtained before the load started. This assumes the
195 // latter. 195 // latter.
196 // TODO(sky): Need a way to set the favicon that doesn't involve generating 196 // TODO(sky): Need a way to set the favicon that doesn't involve generating
197 // its url. 197 // its url.
198 data.favicon_url = current_favicon.is_valid() ? 198 data.favicon_url = current_favicon.is_valid() ?
199 current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url); 199 current_favicon : TemplateURL::GenerateFaviconURL(params.referrer.url);
200 data.safe_for_autoreplace = true; 200 data.safe_for_autoreplace = true;
201 data.input_encodings.push_back(params.searchable_form_encoding); 201 data.input_encodings.push_back(params.searchable_form_encoding);
202 url_service->Add(new TemplateURL(profile, data)); 202 url_service->Add(new TemplateURL(profile, data));
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698