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

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

Issue 367413003: No chrome dependencies in TemplateURLFetcher and TemplateURLParser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 5 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) 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 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_
7 7
8 #include "base/memory/weak_ptr.h"
8 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
9 #include "chrome/browser/ui/find_bar/find_notification_details.h" 10 #include "chrome/browser/ui/find_bar/find_notification_details.h"
10 #include "chrome/common/search_provider.h" 11 #include "chrome/common/search_provider.h"
11 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
13 14
14 class SearchEngineTabHelperDelegate; 15 class SearchEngineTabHelperDelegate;
16 class TemplateURL;
15 17
16 // Per-tab search engine manager. Handles dealing search engine processing 18 // Per-tab search engine manager. Handles dealing search engine processing
17 // functionality. 19 // functionality.
18 class SearchEngineTabHelper 20 class SearchEngineTabHelper
19 : public content::WebContentsObserver, 21 : public content::WebContentsObserver,
20 public content::WebContentsUserData<SearchEngineTabHelper> { 22 public content::WebContentsUserData<SearchEngineTabHelper> {
21 public: 23 public:
22 virtual ~SearchEngineTabHelper(); 24 virtual ~SearchEngineTabHelper();
23 25
24 SearchEngineTabHelperDelegate* delegate() const { return delegate_; } 26 SearchEngineTabHelperDelegate* delegate() const { return delegate_; }
25 void set_delegate(SearchEngineTabHelperDelegate* d) { delegate_ = d; } 27 void set_delegate(SearchEngineTabHelperDelegate* d) { delegate_ = d; }
26 28
27 // content::WebContentsObserver overrides. 29 // content::WebContentsObserver overrides.
28 virtual void DidNavigateMainFrame( 30 virtual void DidNavigateMainFrame(
29 const content::LoadCommittedDetails& details, 31 const content::LoadCommittedDetails& details,
30 const content::FrameNavigateParams& params) OVERRIDE; 32 const content::FrameNavigateParams& params) OVERRIDE;
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 33 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
32 34
33 private: 35 private:
34 explicit SearchEngineTabHelper(content::WebContents* web_contents); 36 explicit SearchEngineTabHelper(content::WebContents* web_contents);
35 friend class content::WebContentsUserData<SearchEngineTabHelper>; 37 friend class content::WebContentsUserData<SearchEngineTabHelper>;
36 38
37 // Handles when a page specifies an OSDD (OpenSearch Description Document). 39 // Handles when a page specifies an OSDD (OpenSearch Description Document).
38 void OnPageHasOSDD(const GURL& page_url, 40 void OnPageHasOSDD(const GURL& page_url,
39 const GURL& osdd_url, 41 const GURL& osdd_url,
40 const search_provider::OSDDType& msg_provider_type); 42 const search_provider::OSDDType& msg_provider_type);
41 43
44 // Handles when an OSDD is downloaded.
45 void OnDownloadedOSDD(scoped_ptr<TemplateURL> template_url);
46
42 // If params has a searchable form, this tries to create a new keyword. 47 // If params has a searchable form, this tries to create a new keyword.
43 void GenerateKeywordIfNecessary( 48 void GenerateKeywordIfNecessary(
44 const content::FrameNavigateParams& params); 49 const content::FrameNavigateParams& params);
45 50
46 // Delegate for notifying our owner about stuff. Not owned by us. 51 // Delegate for notifying our owner about stuff. Not owned by us.
47 SearchEngineTabHelperDelegate* delegate_; 52 SearchEngineTabHelperDelegate* delegate_;
48 53
54 base::WeakPtrFactory<SearchEngineTabHelper> weak_ptr_factory_;
55
49 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); 56 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper);
50 }; 57 };
51 58
52 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ 59 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698