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

Side by Side Diff: chrome/browser/instant/instant_loader.cc

Issue 11416187: Commit instant loader when the instant page navigates away from instant URL. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixing commit for cross process navigation. Created 8 years 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
« no previous file with comments | « chrome/browser/instant/instant_loader.h ('k') | chrome/browser/instant/instant_tab.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 2012 The Chromium Authors. All rights reserved. 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 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/instant/instant_loader.h" 5 #include "chrome/browser/instant/instant_loader.h"
6 6
7 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 7 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
8 #include "chrome/browser/instant/instant_controller.h" 8 #include "chrome/browser/instant/instant_controller.h"
9 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h" 9 #include "chrome/browser/thumbnails/thumbnail_tab_helper.h"
10 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 10 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; 63 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
64 virtual bool CanDownload(content::RenderViewHost* render_view_host, 64 virtual bool CanDownload(content::RenderViewHost* render_view_host,
65 int request_id, 65 int request_id,
66 const std::string& request_method) OVERRIDE; 66 const std::string& request_method) OVERRIDE;
67 virtual void HandleMouseDown() OVERRIDE; 67 virtual void HandleMouseDown() OVERRIDE;
68 virtual void HandleMouseUp() OVERRIDE; 68 virtual void HandleMouseUp() OVERRIDE;
69 virtual void HandlePointerActivate() OVERRIDE; 69 virtual void HandlePointerActivate() OVERRIDE;
70 virtual void HandleGestureEnd() OVERRIDE; 70 virtual void HandleGestureEnd() OVERRIDE;
71 virtual void DragEnded() OVERRIDE; 71 virtual void DragEnded() OVERRIDE;
72 virtual bool OnGoToEntryOffset(int offset) OVERRIDE; 72 virtual bool OnGoToEntryOffset(int offset) OVERRIDE;
73 virtual content::WebContents* OpenURLFromTab(
74 content::WebContents* source,
75 const content::OpenURLParams& params) OVERRIDE;
73 76
74 void MaybeCommitFromPointerRelease(); 77 void MaybeCommitFromPointerRelease();
75 78
76 InstantLoader* const loader_; 79 InstantLoader* const loader_;
77 80
78 DISALLOW_COPY_AND_ASSIGN(WebContentsDelegateImpl); 81 DISALLOW_COPY_AND_ASSIGN(WebContentsDelegateImpl);
79 }; 82 };
80 83
81 InstantLoader::WebContentsDelegateImpl::WebContentsDelegateImpl( 84 InstantLoader::WebContentsDelegateImpl::WebContentsDelegateImpl(
82 InstantLoader* loader) 85 InstantLoader* loader)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // If the user drags, we won't get a mouse up (at least on Linux). Commit the 151 // If the user drags, we won't get a mouse up (at least on Linux). Commit the
149 // Instant result when the drag ends, so that during the drag the page won't 152 // Instant result when the drag ends, so that during the drag the page won't
150 // move around. 153 // move around.
151 MaybeCommitFromPointerRelease(); 154 MaybeCommitFromPointerRelease();
152 } 155 }
153 156
154 bool InstantLoader::WebContentsDelegateImpl::OnGoToEntryOffset(int offset) { 157 bool InstantLoader::WebContentsDelegateImpl::OnGoToEntryOffset(int offset) {
155 return false; 158 return false;
156 } 159 }
157 160
161 content::WebContents* InstantLoader::WebContentsDelegateImpl::OpenURLFromTab(
162 content::WebContents* source,
163 const content::OpenURLParams& params) {
164 content::WebContents* preview = loader_->contents_.get();
165 if (loader_->controller_->CommitIfCurrent(INSTANT_COMMIT_NAVIGATED))
sky 2012/12/10 14:47:30 Style guide says you want one of the following her
Shishir 2012/12/10 18:35:52 Done.
166 return preview->GetDelegate()->OpenURLFromTab(source, params);
167 else
168 return NULL;
169 }
170
158 void InstantLoader::WebContentsDelegateImpl::MaybeCommitFromPointerRelease() { 171 void InstantLoader::WebContentsDelegateImpl::MaybeCommitFromPointerRelease() {
159 if (loader_->is_pointer_down_from_activate_) { 172 if (loader_->is_pointer_down_from_activate_) {
160 loader_->is_pointer_down_from_activate_ = false; 173 loader_->is_pointer_down_from_activate_ = false;
161 loader_->controller_->CommitIfCurrent(INSTANT_COMMIT_FOCUS_LOST); 174 loader_->controller_->CommitIfCurrent(INSTANT_COMMIT_FOCUS_LOST);
162 } 175 }
163 } 176 }
164 177
165 // InstantLoader --------------------------------------------------------------- 178 // InstantLoader ---------------------------------------------------------------
166 179
167 // static 180 // static
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 void InstantLoader::StopCapturingKeyStrokes() { 301 void InstantLoader::StopCapturingKeyStrokes() {
289 InstantSupportDetermined(true); 302 InstantSupportDetermined(true);
290 // NOTE(samarth): the current implementation of the key capturing (invisible 303 // NOTE(samarth): the current implementation of the key capturing (invisible
291 // focus) doesn't require doing anything explicitly here. 304 // focus) doesn't require doing anything explicitly here.
292 } 305 }
293 306
294 void InstantLoader::RenderViewGone() { 307 void InstantLoader::RenderViewGone() {
295 controller_->InstantLoaderRenderViewGone(); 308 controller_->InstantLoaderRenderViewGone();
296 } 309 }
297 310
311 void InstantLoader::AboutToNavigateMainFrame(const GURL& url) {
312 controller_->InstantLoaderAboutToNavigateMainFrame(url);
313 }
314
298 void InstantLoader::Observe(int type, 315 void InstantLoader::Observe(int type,
299 const content::NotificationSource& source, 316 const content::NotificationSource& source,
300 const content::NotificationDetails& details) { 317 const content::NotificationDetails& details) {
301 #if defined(OS_MACOSX) 318 #if defined(OS_MACOSX)
302 if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) { 319 if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) {
303 if (content::RenderWidgetHostView* rwhv = 320 if (content::RenderWidgetHostView* rwhv =
304 contents_->GetRenderWidgetHostView()) 321 contents_->GetRenderWidgetHostView())
305 rwhv->SetTakesFocusOnlyOnMouseDown(true); 322 rwhv->SetTakesFocusOnlyOnMouseDown(true);
306 return; 323 return;
307 } 324 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 content::WebContents* new_contents) { 396 content::WebContents* new_contents) {
380 DCHECK_EQ(old_contents, contents()); 397 DCHECK_EQ(old_contents, contents());
381 CleanupPreviewContents(); 398 CleanupPreviewContents();
382 // We release here without deleting so that the caller still has the 399 // We release here without deleting so that the caller still has the
383 // responsibility for deleting the WebContents. 400 // responsibility for deleting the WebContents.
384 ignore_result(contents_.release()); 401 ignore_result(contents_.release());
385 contents_.reset(new_contents); 402 contents_.reset(new_contents);
386 SetupPreviewContents(); 403 SetupPreviewContents();
387 controller_->SwappedWebContents(); 404 controller_->SwappedWebContents();
388 } 405 }
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_loader.h ('k') | chrome/browser/instant/instant_tab.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698