Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / browser_instant_controller.h
blobb8bf95e03ba31001d66e1cc2c274264dd69ba4f9
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 ~BrowserInstantController() override;
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 void ModelChanged(const SearchModel::State& old_state,
53 const SearchModel::State& new_state) override;
55 // InstantServiceObserver:
56 void DefaultSearchProviderChanged(
57 bool google_base_url_domain_changed) override;
59 // Replaces the contents at tab |index| with |new_contents| and deletes the
60 // existing contents.
61 void ReplaceWebContentsAt(int index,
62 scoped_ptr<content::WebContents> new_contents);
64 Browser* const browser_;
66 InstantController instant_;
68 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
71 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_