Chromium Code Reviews| Index: chrome/browser/ui/browser_instant_controller.h |
| diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h |
| index f154992bd2343718214995631babb4e24e882da3..7660a2b4497cf1c37269d2afe085ae6ae49f8db8 100644 |
| --- a/chrome/browser/ui/browser_instant_controller.h |
| +++ b/chrome/browser/ui/browser_instant_controller.h |
| @@ -10,6 +10,7 @@ |
| #include "base/prefs/public/pref_change_registrar.h" |
| #include "chrome/browser/instant/instant_controller.h" |
| #include "chrome/browser/instant/instant_unload_handler.h" |
| +#include "chrome/browser/ui/browser.h" |
|
sky
2013/02/05 21:40:13
Can you not inline profile() so that you don't nee
samarth
2013/02/05 22:41:57
Done.
|
| #include "chrome/browser/ui/search/search_model_observer.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| @@ -43,17 +44,32 @@ class BrowserInstantController : public content::NotificationObserver, |
| // Registers Instant related preferences. |
| static void RegisterUserPrefs(PrefServiceSyncable* prefs); |
| + // If |url| is the new tab page URL, set |target_contents| to the preloaded |
| + // NTP contents from InstantController. If |source_contents| is not NULL, we |
| + // replace it with the new |target_contents| in the tabstrip and delete |
| + // |source_contents|. Otherwise, the caller owns |target_contents| and is |
| + // responsible for inserting it into the tabstrip. |
| + // |
| + // Returns true if and only if we update |target_contents|. |
| + bool MaybeSwapInInstantNTPContents( |
| + const GURL& url, |
| + content::WebContents* source_contents, |
| + content::WebContents** target_contents); |
| + |
| // Commits the current Instant, returning true on success. This is intended |
| // for use from OpenCurrentURL. |
| bool OpenInstant(WindowOpenDisposition disposition); |
| + // Returns the Profile associated with the Browser that owns this object. |
| + Profile* profile() const { return browser_->profile(); } |
| + |
| // Returns the InstantController or NULL if there is no InstantController for |
| // this BrowserInstantController. |
| InstantController* instant() { return &instant_; } |
| // Invoked by |instant_| to commit the |preview| by merging it into the active |
| - // tab or adding it as a new tab. We take ownership of |preview|. |
| - void CommitInstant(content::WebContents* preview, bool in_new_tab); |
| + // tab or adding it as a new tab. |
| + void CommitInstant(scoped_ptr<content::WebContents> preview, bool in_new_tab); |
| // Invoked by |instant_| to autocomplete the |suggestion| into the omnibox. |
| void SetInstantSuggestion(const InstantSuggestion& suggestion); |
| @@ -113,6 +129,14 @@ class BrowserInstantController : public content::NotificationObserver, |
| // Helper for handling theme area height change. |
| void OnThemeAreaHeightChanged(int height); |
| + // Replaces the contents at tab |index| with |new_contents| and deletes the |
| + // existing contents. |
| + void ReplaceWebContentsAt(int index, |
| + scoped_ptr<content::WebContents> new_contents); |
| + |
| + // Focuses the omnibox if the active tab is the NTP. |
| + void FocusOmniboxForNTP(); |
| + |
| Browser* const browser_; |
| InstantController instant_; |