OLD | NEW |
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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
10 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 10 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
| 11 #include "chrome/common/search_provider.h" |
11 #include "content/browser/tab_contents/tab_contents_observer.h" | 12 #include "content/browser/tab_contents/tab_contents_observer.h" |
12 | 13 |
13 class SearchEngineTabHelperDelegate; | 14 class SearchEngineTabHelperDelegate; |
14 class TabContentsWrapper; | 15 class TabContentsWrapper; |
15 struct ViewHostMsg_PageHasOSDD_Type; | |
16 | 16 |
17 // Per-tab search engine manager. Handles dealing search engine processing | 17 // Per-tab search engine manager. Handles dealing search engine processing |
18 // functionality. | 18 // functionality. |
19 class SearchEngineTabHelper : public TabContentsObserver { | 19 class SearchEngineTabHelper : public TabContentsObserver { |
20 public: | 20 public: |
21 explicit SearchEngineTabHelper(TabContents* tab_contents); | 21 explicit SearchEngineTabHelper(TabContents* tab_contents); |
22 virtual ~SearchEngineTabHelper(); | 22 virtual ~SearchEngineTabHelper(); |
23 | 23 |
24 SearchEngineTabHelperDelegate* delegate() const { return delegate_; } | 24 SearchEngineTabHelperDelegate* delegate() const { return delegate_; } |
25 void set_delegate(SearchEngineTabHelperDelegate* d) { delegate_ = d; } | 25 void set_delegate(SearchEngineTabHelperDelegate* d) { delegate_ = d; } |
26 | 26 |
27 // TabContentsObserver overrides. | 27 // TabContentsObserver overrides. |
28 virtual void DidNavigateMainFramePostCommit( | 28 virtual void DidNavigateMainFramePostCommit( |
29 const NavigationController::LoadCommittedDetails& details, | 29 const NavigationController::LoadCommittedDetails& details, |
30 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | 30 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; |
31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 31 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
32 | 32 |
33 private: | 33 private: |
34 // Handles when a page specifies an OSDD (OpenSearch Description Document). | 34 // Handles when a page specifies an OSDD (OpenSearch Description Document). |
35 void OnPageHasOSDD(int32 page_id, | 35 void OnPageHasOSDD(int32 page_id, |
36 const GURL& doc_url, | 36 const GURL& doc_url, |
37 const ViewHostMsg_PageHasOSDD_Type& msg_provider_type); | 37 const search_provider::OSDDType& msg_provider_type); |
38 | 38 |
39 // If params has a searchable form, this tries to create a new keyword. | 39 // If params has a searchable form, this tries to create a new keyword. |
40 void GenerateKeywordIfNecessary( | 40 void GenerateKeywordIfNecessary( |
41 const ViewHostMsg_FrameNavigate_Params& params); | 41 const ViewHostMsg_FrameNavigate_Params& params); |
42 | 42 |
43 // Delegate for notifying our owner about stuff. Not owned by us. | 43 // Delegate for notifying our owner about stuff. Not owned by us. |
44 SearchEngineTabHelperDelegate* delegate_; | 44 SearchEngineTabHelperDelegate* delegate_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); | 46 DISALLOW_COPY_AND_ASSIGN(SearchEngineTabHelper); |
47 }; | 47 }; |
48 | 48 |
49 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ | 49 #endif // CHROME_BROWSER_UI_SEARCH_ENGINES_SEARCH_ENGINE_TAB_HELPER_H_ |
OLD | NEW |