Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 8298005: Fixes bug in instant where we would end up incorrectly using the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/instant/instant_delegate.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 3147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 } 3158 }
3159 3159
3160 void Browser::TabDetachedAt(TabContentsWrapper* contents, int index) { 3160 void Browser::TabDetachedAt(TabContentsWrapper* contents, int index) {
3161 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); 3161 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
3162 } 3162 }
3163 3163
3164 void Browser::TabDeactivated(TabContentsWrapper* contents) { 3164 void Browser::TabDeactivated(TabContentsWrapper* contents) {
3165 if (contents == fullscreened_tab_) 3165 if (contents == fullscreened_tab_)
3166 ExitTabbedFullscreenModeIfNecessary(); 3166 ExitTabbedFullscreenModeIfNecessary();
3167 if (instant()) 3167 if (instant())
3168 instant()->DestroyPreviewContentsAndLeaveActive(); 3168 instant()->Hide();
3169 3169
3170 // Save what the user's currently typing, so it can be restored when we 3170 // Save what the user's currently typing, so it can be restored when we
3171 // switch back to this tab. 3171 // switch back to this tab.
3172 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents()); 3172 window_->GetLocationBar()->SaveStateToContents(contents->tab_contents());
3173 } 3173 }
3174 3174
3175 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents, 3175 void Browser::ActiveTabChanged(TabContentsWrapper* old_contents,
3176 TabContentsWrapper* new_contents, 3176 TabContentsWrapper* new_contents,
3177 int index, 3177 int index,
3178 bool user_gesture) { 3178 bool user_gesture) {
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
4147 4147
4148 /////////////////////////////////////////////////////////////////////////////// 4148 ///////////////////////////////////////////////////////////////////////////////
4149 // Browser, InstantDelegate implementation: 4149 // Browser, InstantDelegate implementation:
4150 4150
4151 void Browser::ShowInstant(TabContentsWrapper* preview_contents) { 4151 void Browser::ShowInstant(TabContentsWrapper* preview_contents) {
4152 DCHECK(instant_->tab_contents() == GetSelectedTabContentsWrapper()); 4152 DCHECK(instant_->tab_contents() == GetSelectedTabContentsWrapper());
4153 window_->ShowInstant(preview_contents); 4153 window_->ShowInstant(preview_contents);
4154 } 4154 }
4155 4155
4156 void Browser::HideInstant() { 4156 void Browser::HideInstant() {
4157 window_->HideInstant(instant_->is_active()); 4157 window_->HideInstant();
4158 } 4158 }
4159 4159
4160 void Browser::CommitInstant(TabContentsWrapper* preview_contents) { 4160 void Browser::CommitInstant(TabContentsWrapper* preview_contents) {
4161 TabContentsWrapper* tab_contents = instant_->tab_contents(); 4161 TabContentsWrapper* tab_contents = instant_->tab_contents();
4162 int index = 4162 int index =
4163 tab_handler_->GetTabStripModel()->GetIndexOfTabContents(tab_contents); 4163 tab_handler_->GetTabStripModel()->GetIndexOfTabContents(tab_contents);
4164 DCHECK_NE(TabStripModel::kNoTab, index); 4164 DCHECK_NE(TabStripModel::kNoTab, index);
4165 // TabStripModel takes ownership of preview_contents. 4165 // TabStripModel takes ownership of preview_contents.
4166 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt( 4166 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt(
4167 index, preview_contents); 4167 index, preview_contents);
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
5095 const TabContents* base_tab_contents, 5095 const TabContents* base_tab_contents,
5096 SessionStorageNamespace* session_storage_namespace) { 5096 SessionStorageNamespace* session_storage_namespace) {
5097 TabContents* new_contents = new TabContents(profile, site_instance, 5097 TabContents* new_contents = new TabContents(profile, site_instance,
5098 routing_id, base_tab_contents, 5098 routing_id, base_tab_contents,
5099 session_storage_namespace); 5099 session_storage_namespace);
5100 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents); 5100 TabContentsWrapper* wrapper = new TabContentsWrapper(new_contents);
5101 return wrapper; 5101 return wrapper;
5102 } 5102 }
5103 5103
5104 bool Browser::OpenInstant(WindowOpenDisposition disposition) { 5104 bool Browser::OpenInstant(WindowOpenDisposition disposition) {
5105 if (!instant() || !instant()->is_active() || !instant()->PrepareForCommit() || 5105 if (!instant() || !instant()->PrepareForCommit() ||
5106 disposition == NEW_BACKGROUND_TAB) { 5106 disposition == NEW_BACKGROUND_TAB) {
5107 // NEW_BACKGROUND_TAB results in leaving the omnibox open, so we don't 5107 // NEW_BACKGROUND_TAB results in leaving the omnibox open, so we don't
5108 // attempt to use the instant preview. 5108 // attempt to use the instant preview.
5109 return false; 5109 return false;
5110 } 5110 }
5111 5111
5112 if (disposition == CURRENT_TAB) { 5112 if (disposition == CURRENT_TAB) {
5113 NotificationService::current()->Notify( 5113 NotificationService::current()->Notify(
5114 chrome::NOTIFICATION_INSTANT_COMMITTED, 5114 chrome::NOTIFICATION_INSTANT_COMMITTED,
5115 Source<TabContentsWrapper>(instant()->CommitCurrentPreview( 5115 Source<TabContentsWrapper>(instant()->CommitCurrentPreview(
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
5306 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type); 5306 window_->GetLocationBar()->ShowFirstRunBubble(bubble_type);
5307 } else if (is_type_tabbed()) { 5307 } else if (is_type_tabbed()) {
5308 GlobalErrorService* service = 5308 GlobalErrorService* service =
5309 GlobalErrorServiceFactory::GetForProfile(profile()); 5309 GlobalErrorServiceFactory::GetForProfile(profile());
5310 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); 5310 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView();
5311 if (error) { 5311 if (error) {
5312 error->ShowBubbleView(this); 5312 error->ShowBubbleView(this);
5313 } 5313 }
5314 } 5314 }
5315 } 5315 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_delegate.h ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698