[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / browser_instant_controller.h
blob3953c69f4d72882b5f7e9e744698adef41bda88f
1 // Copyright 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.
5 #ifndef CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/search/instant_service_observer.h"
13 #include "chrome/browser/ui/search/instant_controller.h"
14 #include "chrome/browser/ui/search/search_model_observer.h"
16 class Browser;
17 struct InstantSuggestion;
18 class Profile;
20 namespace content {
21 class WebContents;
24 class BrowserInstantController : public SearchModelObserver,
25 public InstantServiceObserver {
26 public:
27 explicit BrowserInstantController(Browser* browser);
28 virtual ~BrowserInstantController();
30 // Commits the current Instant, returning true on success. This is intended
31 // for use from OpenCurrentURL.
32 bool OpenInstant(WindowOpenDisposition disposition, const GURL& url);
34 // Returns the Profile associated with the Browser that owns this object.
35 Profile* profile() const;
37 // Returns the InstantController or NULL if there is no InstantController for
38 // this BrowserInstantController.
39 InstantController* instant() { return &instant_; }
41 // Invoked by |instant_| to get the currently active tab.
42 content::WebContents* GetActiveWebContents() const;
44 // Invoked by |browser_| when the active tab changes.
45 void ActiveTabChanged();
47 // Invoked by |browser_| when the active tab is about to be deactivated.
48 void TabDeactivated(content::WebContents* contents);
50 private:
51 // SearchModelObserver:
52 virtual void ModelChanged(const SearchModel::State& old_state,
53 const SearchModel::State& new_state) OVERRIDE;
55 // InstantServiceObserver:
56 virtual void DefaultSearchProviderChanged() OVERRIDE;
58 // Replaces the contents at tab |index| with |new_contents| and deletes the
59 // existing contents.
60 void ReplaceWebContentsAt(int index,
61 scoped_ptr<content::WebContents> new_contents);
63 Browser* const browser_;
65 InstantController instant_;
67 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
70 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_