diff options
author | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-03 21:20:42 +0000 |
---|---|---|
committer | fischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-03 21:20:42 +0000 |
commit | f46186424021ba2d70ce2c1626da43572bff43d0 (patch) | |
tree | 6f34c140d35ed82858c693049f9215d7ab5cfac9 /chrome/browser/ui/browser_instant_controller.cc | |
parent | 97e6692430f166051246395802a26c6b325b54a4 (diff) | |
download | chromium_src-f46186424021ba2d70ce2c1626da43572bff43d0.zip chromium_src-f46186424021ba2d70ce2c1626da43572bff43d0.tar.gz chromium_src-f46186424021ba2d70ce2c1626da43572bff43d0.tar.bz2 |
Revert 210036 "InstantExtended: Remove overlay control code."
Broke the http://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20ChromeOS/builds/55501/steps/compile/logs/stdio build, and probably all enable_rlz=1 builds.
> InstantExtended: Remove overlay control code.
>
> This change deletes the browser-side InstantController code pertaining
> to old Instant, the HTML popup and search results overlay. A lot of UI
> and renderer code is still lingering and doing nothing, but I'll get
> that in another CL.
>
> TEST=Manually. Verify that InstantExtended NTP and searching works, and
> that normal Chrome is unaffected.
> BUG=251262
> TBR=brettw@chromium.org
>
> Review URL: https://chromiumcodereview.appspot.com/18223002
TBR=jered@chromium.org
Review URL: https://codereview.chromium.org/18654004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser_instant_controller.cc')
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.cc | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 6203f51..aa8b59d 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -37,7 +37,8 @@ using content::UserMetricsAction; BrowserInstantController::BrowserInstantController(Browser* browser) : browser_(browser), - instant_(this, chrome::IsInstantExtendedAPIEnabled()), + instant_(this, + chrome::IsInstantExtendedAPIEnabled()), instant_unload_handler_(browser) { // TODO(sreeram): Perhaps this can be removed, if field trial info is @@ -145,6 +146,29 @@ Profile* BrowserInstantController::profile() const { return browser_->profile(); } +void BrowserInstantController::CommitInstant( + scoped_ptr<content::WebContents> overlay, + bool in_new_tab) { + const extensions::Extension* extension = + profile()->GetExtensionService()->GetInstalledApp(overlay->GetURL()); + if (extension) { + AppLauncherHandler::RecordAppLaunchType( + extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, + extension->GetType()); + } + if (in_new_tab) { + // TabStripModel takes ownership of |overlay|. + browser_->tab_strip_model()->AddWebContents(overlay.release(), -1, + instant_.last_transition_type(), TabStripModel::ADD_ACTIVE); + } else { + content::WebContents* contents = overlay.get(); + ReplaceWebContentsAt( + browser_->tab_strip_model()->active_index(), + overlay.Pass()); + browser_->window()->GetLocationBar()->SaveStateToContents(contents); + } +} + void BrowserInstantController::ReplaceWebContentsAt( int index, scoped_ptr<content::WebContents> new_contents) { @@ -155,6 +179,20 @@ void BrowserInstantController::ReplaceWebContentsAt( index); } +void BrowserInstantController::SetInstantSuggestion( + const InstantSuggestion& suggestion) { + browser_->window()->GetLocationBar()->SetInstantSuggestion(suggestion); +} + +gfx::Rect BrowserInstantController::GetInstantBounds() { + return browser_->window()->GetInstantBounds(); +} + +void BrowserInstantController::InstantOverlayFocused() { + // NOTE: This is only invoked on aura. + browser_->window()->WebContentsFocused(instant_.GetOverlayContents()); +} + void BrowserInstantController::FocusOmnibox(bool caret_visibility) { OmniboxView* omnibox_view = browser_->window()->GetLocationBar()-> GetLocationEntry(); @@ -206,7 +244,9 @@ void BrowserInstantController::ToggleVoiceSearch() { } void BrowserInstantController::ResetInstant(const std::string& pref_name) { - instant_.ReloadStaleNTP(); + bool instant_checkbox_checked = chrome::IsInstantCheckboxChecked(profile()); + bool use_local_overlay_only = !chrome::IsInstantCheckboxEnabled(profile()); + instant_.SetInstantEnabled(instant_checkbox_checked, use_local_overlay_only); } //////////////////////////////////////////////////////////////////////////////// |