• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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 #pragma once
8 
9 #include "base/basictypes.h"
10 #include "chrome/browser/search_engines/template_url_fetcher_callbacks.h"
11 #include "content/common/notification_observer.h"
12 #include "content/common/notification_registrar.h"
13 
14 class SearchEngineTabHelper;
15 class TabContents;
16 
17 // Callbacks which display UI for the TemplateURLFetcher.
18 class TemplateURLFetcherUICallbacks : public TemplateURLFetcherCallbacks,
19                                       public NotificationObserver {
20  public:
21   explicit TemplateURLFetcherUICallbacks(SearchEngineTabHelper* tab_helper,
22                                          TabContents* tab_contents);
23   virtual ~TemplateURLFetcherUICallbacks();
24 
25   // TemplateURLFetcherCallback implementation.
26   virtual void ConfirmSetDefaultSearchProvider(
27       TemplateURL* template_url,
28       TemplateURLModel* template_url_model);
29   virtual void ConfirmAddSearchProvider(
30       TemplateURL* template_url,
31       Profile* profile);
32 
33   // NotificationObserver:
34   virtual void Observe(NotificationType type,
35                        const NotificationSource& source,
36                        const NotificationDetails& details);
37 
38  private:
39   // The SearchEngineTabHelper where this request originated. Can be NULL if the
40   // originating tab is closed. If NULL, the engine is not added.
41   SearchEngineTabHelper* source_;
42 
43   // The TabContents where this request originated.
44   TabContents* tab_contents_;
45 
46   // Handles registering for our notifications.
47   NotificationRegistrar registrar_;
48 
49   DISALLOW_COPY_AND_ASSIGN(TemplateURLFetcherUICallbacks);
50 };
51 
52 #endif  // CHROME_BROWSER_UI_SEARCH_ENGINES_TEMPLATE_URL_FETCHER_UI_CALLBACKS_H_
53