Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / browser_instant_controller.h
blob6af5d03725794545bbf0f65409541ef75e6c8f96
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 namespace gfx {
25 class Rect;
28 class BrowserInstantController : public SearchModelObserver,
29 public InstantServiceObserver {
30 public:
31 explicit BrowserInstantController(Browser* browser);
32 virtual ~BrowserInstantController();
34 // Commits the current Instant, returning true on success. This is intended
35 // for use from OpenCurrentURL.
36 bool OpenInstant(WindowOpenDisposition disposition, const GURL& url);
38 // Returns the Profile associated with the Browser that owns this object.
39 Profile* profile() const;
41 // Returns the InstantController or NULL if there is no InstantController for
42 // this BrowserInstantController.
43 InstantController* instant() { return &instant_; }
45 // Invoked by |instant_| to get the currently active tab.
46 content::WebContents* GetActiveWebContents() const;
48 // Invoked by |browser_| when the active tab changes.
49 void ActiveTabChanged();
51 // Invoked by |browser_| when the active tab is about to be deactivated.
52 void TabDeactivated(content::WebContents* contents);
54 // Sets the stored omnibox bounds.
55 void SetOmniboxBounds(const gfx::Rect& bounds);
57 private:
58 // Overridden from search::SearchModelObserver:
59 virtual void ModelChanged(const SearchModel::State& old_state,
60 const SearchModel::State& new_state) OVERRIDE;
62 // Overridden from InstantServiceObserver:
63 virtual void DefaultSearchProviderChanged() OVERRIDE;
64 virtual void GoogleURLUpdated() OVERRIDE;
66 // Reloads the tabs in instant process to ensure that their privileged status
67 // is still valid.
68 void ReloadTabsInInstantProcess();
70 // Replaces the contents at tab |index| with |new_contents| and deletes the
71 // existing contents.
72 void ReplaceWebContentsAt(int index,
73 scoped_ptr<content::WebContents> new_contents);
75 Browser* const browser_;
77 InstantController instant_;
79 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
82 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_