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

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

Issue 8603015: Get rid of a bunch of view_messages.h includes from chrome by making the TabContentsObserver inte... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix linux and try to fix mac again Created 9 years, 1 month 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) 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/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_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h" 11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h" 12 #include "chrome/browser/ui/search_engines/template_url_fetcher_ui_callbacks.h"
13 #include "chrome/common/render_messages.h" 13 #include "chrome/common/render_messages.h"
14 #include "content/common/view_messages.h"
15 #include "content/browser/tab_contents/tab_contents.h" 14 #include "content/browser/tab_contents/tab_contents.h"
15 #include "content/public/common/frame_navigate_params.h"
16 16
17 namespace { 17 namespace {
18 18
19 // Returns true if the entry's transition type is FORM_SUBMIT. 19 // Returns true if the entry's transition type is FORM_SUBMIT.
20 bool IsFormSubmit(const NavigationEntry* entry) { 20 bool IsFormSubmit(const NavigationEntry* entry) {
21 return (content::PageTransitionStripQualifier(entry->transition_type()) == 21 return (content::PageTransitionStripQualifier(entry->transition_type()) ==
22 content::PAGE_TRANSITION_FORM_SUBMIT); 22 content::PAGE_TRANSITION_FORM_SUBMIT);
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 SearchEngineTabHelper::SearchEngineTabHelper(TabContents* tab_contents) 27 SearchEngineTabHelper::SearchEngineTabHelper(TabContents* tab_contents)
28 : TabContentsObserver(tab_contents) { 28 : TabContentsObserver(tab_contents) {
29 DCHECK(tab_contents); 29 DCHECK(tab_contents);
30 } 30 }
31 31
32 SearchEngineTabHelper::~SearchEngineTabHelper() { 32 SearchEngineTabHelper::~SearchEngineTabHelper() {
33 } 33 }
34 34
35 void SearchEngineTabHelper::DidNavigateMainFrame( 35 void SearchEngineTabHelper::DidNavigateMainFrame(
36 const content::LoadCommittedDetails& /*details*/, 36 const content::LoadCommittedDetails& /*details*/,
37 const ViewHostMsg_FrameNavigate_Params& params) { 37 const content::FrameNavigateParams& params) {
38 GenerateKeywordIfNecessary(params); 38 GenerateKeywordIfNecessary(params);
39 } 39 }
40 40
41 bool SearchEngineTabHelper::OnMessageReceived(const IPC::Message& message) { 41 bool SearchEngineTabHelper::OnMessageReceived(const IPC::Message& message) {
42 bool handled = true; 42 bool handled = true;
43 IPC_BEGIN_MESSAGE_MAP(SearchEngineTabHelper, message) 43 IPC_BEGIN_MESSAGE_MAP(SearchEngineTabHelper, message)
44 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PageHasOSDD, OnPageHasOSDD) 44 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_PageHasOSDD, OnPageHasOSDD)
45 IPC_MESSAGE_UNHANDLED(handled = false) 45 IPC_MESSAGE_UNHANDLED(handled = false)
46 IPC_END_MESSAGE_MAP() 46 IPC_END_MESSAGE_MAP()
47 47
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // new keyword will be created when done. 120 // new keyword will be created when done.
121 profile->GetTemplateURLFetcher()->ScheduleDownload( 121 profile->GetTemplateURLFetcher()->ScheduleDownload(
122 keyword, 122 keyword,
123 doc_url, 123 doc_url,
124 base_entry->favicon().url(), 124 base_entry->favicon().url(),
125 new TemplateURLFetcherUICallbacks(this, tab_contents()), 125 new TemplateURLFetcherUICallbacks(this, tab_contents()),
126 provider_type); 126 provider_type);
127 } 127 }
128 128
129 void SearchEngineTabHelper::GenerateKeywordIfNecessary( 129 void SearchEngineTabHelper::GenerateKeywordIfNecessary(
130 const ViewHostMsg_FrameNavigate_Params& params) { 130 const content::FrameNavigateParams& params) {
131 if (!params.searchable_form_url.is_valid()) 131 if (!params.searchable_form_url.is_valid())
132 return; 132 return;
133 133
134 Profile* profile = 134 Profile* profile =
135 Profile::FromBrowserContext(tab_contents()->browser_context()); 135 Profile::FromBrowserContext(tab_contents()->browser_context());
136 if (profile->IsOffTheRecord()) 136 if (profile->IsOffTheRecord())
137 return; 137 return;
138 138
139 const NavigationController& controller = tab_contents()->controller(); 139 const NavigationController& controller = tab_contents()->controller();
140 int last_index = controller.last_committed_entry_index(); 140 int last_index = controller.last_committed_entry_index();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 // The favicon url isn't valid. This means there really isn't a favicon, 196 // The favicon url isn't valid. This means there really isn't a favicon,
197 // or the favicon url wasn't obtained before the load started. This assumes 197 // or the favicon url wasn't obtained before the load started. This assumes
198 // the later. 198 // the later.
199 // TODO(sky): Need a way to set the favicon that doesn't involve generating 199 // TODO(sky): Need a way to set the favicon that doesn't involve generating
200 // its url. 200 // its url.
201 new_url->SetFaviconURL(TemplateURL::GenerateFaviconURL(params.referrer)); 201 new_url->SetFaviconURL(TemplateURL::GenerateFaviconURL(params.referrer));
202 } 202 }
203 new_url->set_safe_for_autoreplace(true); 203 new_url->set_safe_for_autoreplace(true);
204 url_service->Add(new_url); 204 url_service->Add(new_url);
205 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search_engines/search_engine_tab_helper.h ('k') | chrome/tools/ipclist/ipcfuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698