Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / search_engines / template_url_fetcher_ui_callbacks.h
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_UI_CALLBACKS_H_
6 #define CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_UI_CALLBACKS_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/search_engines/template_url_fetcher_callbacks.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13
14 class SearchEngineTabHelper;
15
16 namespace content {
17 class WebContents;
18 }
19
20 // Callbacks which display UI for the TemplateURLFetcher.
21 class TemplateURLFetcherUICallbacks : public TemplateURLFetcherCallbacks,
22                                       public content::NotificationObserver {
23  public:
24   TemplateURLFetcherUICallbacks(SearchEngineTabHelper* tab_helper,
25                                 content::WebContents* web_contents);
26   virtual ~TemplateURLFetcherUICallbacks();
27
28   // TemplateURLFetcherCallback implementation.
29   virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
30                                         Profile* profile) OVERRIDE;
31
32   // content::NotificationObserver:
33   virtual void Observe(int type,
34                        const content::NotificationSource& source,
35                        const content::NotificationDetails& details) OVERRIDE;
36
37  private:
38   // The SearchEngineTabHelper where this request originated. Can be NULL if the
39   // originating tab is closed. If NULL, the engine is not added.
40   SearchEngineTabHelper* source_;
41
42   // The WebContents where this request originated.
43   content::WebContents* web_contents_;
44
45   // Handles registering for our notifications.
46   content::NotificationRegistrar registrar_;
47
48   DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcherUICallbacks);
49 };
50
51 #endif  // CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_UI_CALLBACKS_H_