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

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

Issue 10828374: Always call WasShown() before trying to paint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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_browsertest.cc ('k') | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_instant_controller.h" 5 #include "chrome/browser/ui/browser_instant_controller.h"
6 6
7 #include "chrome/browser/browser_shutdown.h" 7 #include "chrome/browser/browser_shutdown.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/instant/instant_controller.h" 9 #include "chrome/browser/instant/instant_controller.h"
10 #include "chrome/browser/instant/instant_unload_handler.h" 10 #include "chrome/browser/instant/instant_unload_handler.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // support for the new disposition. 71 // support for the new disposition.
72 NOTREACHED(); 72 NOTREACHED();
73 return false; 73 return false;
74 } 74 }
75 75
76 //////////////////////////////////////////////////////////////////////////////// 76 ////////////////////////////////////////////////////////////////////////////////
77 // BrowserInstantController, InstantControllerDelegate implementation: 77 // BrowserInstantController, InstantControllerDelegate implementation:
78 78
79 void BrowserInstantController::ShowInstant() { 79 void BrowserInstantController::ShowInstant() {
80 TabContents* preview = instant_->GetPreviewContents(); 80 TabContents* preview = instant_->GetPreviewContents();
81 preview->web_contents()->WasShown();
sky 2012/08/20 16:29:31 Any reason you're not putting this in InstantContr
sreeram_google.com 2012/08/20 16:36:45 No particular reason. Historically, this code has
sreeram 2012/08/20 16:46:25 I forgot to add that, since the Browser operates o
81 browser_->window()->ShowInstant(preview); 82 browser_->window()->ShowInstant(preview);
82 83
83 content::NotificationService::current()->Notify( 84 content::NotificationService::current()->Notify(
84 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN, 85 chrome::NOTIFICATION_INSTANT_CONTROLLER_SHOWN,
85 content::Source<InstantController>(instant()), 86 content::Source<InstantController>(instant()),
86 content::NotificationService::NoDetails()); 87 content::NotificationService::NoDetails());
87 88
88 // TODO(beng): Investigate if we can avoid this and instead rely on the 89 // TODO(beng): Investigate if we can avoid this and instead rely on the
89 // visibility of the WebContentsView. 90 // visibility of the WebContentsView.
90 chrome::GetActiveWebContents(browser_)->WasHidden(); 91 chrome::GetActiveWebContents(browser_)->WasHidden();
91 preview->web_contents()->WasShown();
92 } 92 }
93 93
94 void BrowserInstantController::HideInstant() { 94 void BrowserInstantController::HideInstant() {
95 if (chrome::GetActiveWebContents(browser_))
96 chrome::GetActiveWebContents(browser_)->WasShown();
sky 2012/08/20 16:29:31 How come you're moving this?
sreeram_google.com 2012/08/20 16:36:45 Same reason as before. When we call browser_->wind
97
95 browser_->window()->HideInstant(); 98 browser_->window()->HideInstant();
96 99
97 content::NotificationService::current()->Notify( 100 content::NotificationService::current()->Notify(
98 chrome::NOTIFICATION_INSTANT_CONTROLLER_HIDDEN, 101 chrome::NOTIFICATION_INSTANT_CONTROLLER_HIDDEN,
99 content::Source<InstantController>(instant()), 102 content::Source<InstantController>(instant()),
100 content::NotificationService::NoDetails()); 103 content::NotificationService::NoDetails());
101 104
102 if (chrome::GetActiveWebContents(browser_))
103 chrome::GetActiveWebContents(browser_)->WasShown();
104 if (TabContents* preview = instant_->GetPreviewContents()) 105 if (TabContents* preview = instant_->GetPreviewContents())
105 preview->web_contents()->WasHidden(); 106 preview->web_contents()->WasHidden();
106 } 107 }
107 108
108 void BrowserInstantController::CommitInstant(TabContents* preview) { 109 void BrowserInstantController::CommitInstant(TabContents* preview) {
109 TabContents* active_tab = chrome::GetActiveTabContents(browser_); 110 TabContents* active_tab = chrome::GetActiveTabContents(browser_);
110 int index = browser_->tab_strip_model()->GetIndexOfTabContents(active_tab); 111 int index = browser_->tab_strip_model()->GetIndexOfTabContents(active_tab);
111 DCHECK_NE(TabStripModel::kNoTab, index); 112 DCHECK_NE(TabStripModel::kNoTab, index);
112 // TabStripModel takes ownership of |preview|. 113 // TabStripModel takes ownership of |preview|.
113 browser_->tab_strip_model()->ReplaceTabContentsAt(index, preview); 114 browser_->tab_strip_model()->ReplaceTabContentsAt(index, preview);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 browser_->is_type_tabbed() && !browser_->profile()->IsOffTheRecord()) { 174 browser_->is_type_tabbed() && !browser_->profile()->IsOffTheRecord()) {
174 instant_.reset(new InstantController(this, InstantController::INSTANT)); 175 instant_.reset(new InstantController(this, InstantController::INSTANT));
175 instant_unload_handler_.reset(new InstantUnloadHandler(browser_)); 176 instant_unload_handler_.reset(new InstantUnloadHandler(browser_));
176 } else { 177 } else {
177 instant_.reset(); 178 instant_.reset();
178 instant_unload_handler_.reset(); 179 instant_unload_handler_.reset();
179 } 180 }
180 } 181 }
181 182
182 } // namespace chrome 183 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698