Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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/history/history_types.h" | 8 #include "chrome/browser/history/history_types.h" |
| 9 #include "chrome/browser/instant/instant_loader_delegate.h" | 9 #include "chrome/browser/instant/instant_loader_delegate.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; | 52 virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE; |
| 53 virtual bool CanDownload(content::RenderViewHost* render_view_host, | 53 virtual bool CanDownload(content::RenderViewHost* render_view_host, |
| 54 int request_id, | 54 int request_id, |
| 55 const std::string& request_method) OVERRIDE; | 55 const std::string& request_method) OVERRIDE; |
| 56 virtual void HandleMouseUp() OVERRIDE; | 56 virtual void HandleMouseUp() OVERRIDE; |
| 57 virtual void HandlePointerActivate() OVERRIDE; | 57 virtual void HandlePointerActivate() OVERRIDE; |
| 58 virtual void HandleGestureBegin() OVERRIDE; | 58 virtual void HandleGestureBegin() OVERRIDE; |
| 59 virtual void HandleGestureEnd() OVERRIDE; | 59 virtual void HandleGestureEnd() OVERRIDE; |
| 60 virtual void DragEnded() OVERRIDE; | 60 virtual void DragEnded() OVERRIDE; |
| 61 virtual bool OnGoToEntryOffset(int offset) OVERRIDE; | 61 virtual bool OnGoToEntryOffset(int offset) OVERRIDE; |
| 62 virtual bool ShouldAddNavigationToHistory( | |
| 63 const history::HistoryAddPageArgs& add_page_args, | |
| 64 content::NavigationType navigation_type) OVERRIDE; | |
| 65 | 62 |
| 66 // content::WebContentsObserver: | 63 // content::WebContentsObserver: |
| 67 virtual void DidFinishLoad( | 64 virtual void DidFinishLoad( |
| 68 int64 frame_id, | 65 int64 frame_id, |
| 69 const GURL& validated_url, | 66 const GURL& validated_url, |
| 70 bool is_main_frame, | 67 bool is_main_frame, |
| 71 content::RenderViewHost* render_view_host) OVERRIDE; | 68 content::RenderViewHost* render_view_host) OVERRIDE; |
| 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 73 | 70 |
| 74 private: | 71 private: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 // If the user drags, we won't get a mouse up (at least on Linux). Commit the | 159 // If the user drags, we won't get a mouse up (at least on Linux). Commit the |
| 163 // Instant result when the drag ends, so that during the drag the page won't | 160 // Instant result when the drag ends, so that during the drag the page won't |
| 164 // move around. | 161 // move around. |
| 165 CommitFromPointerReleaseIfNecessary(); | 162 CommitFromPointerReleaseIfNecessary(); |
| 166 } | 163 } |
| 167 | 164 |
| 168 bool InstantLoader::WebContentsDelegateImpl::OnGoToEntryOffset(int offset) { | 165 bool InstantLoader::WebContentsDelegateImpl::OnGoToEntryOffset(int offset) { |
| 169 return false; | 166 return false; |
| 170 } | 167 } |
| 171 | 168 |
| 172 bool InstantLoader::WebContentsDelegateImpl::ShouldAddNavigationToHistory( | |
| 173 const history::HistoryAddPageArgs& add_page_args, | |
| 174 content::NavigationType navigation_type) { | |
| 175 loader_->last_navigation_ = add_page_args; | |
|
sky
2012/09/25 15:38:48
How come you're removing this? This is the main pl
| |
| 176 return false; | |
| 177 } | |
| 178 | |
| 179 void InstantLoader::WebContentsDelegateImpl::DidFinishLoad( | 169 void InstantLoader::WebContentsDelegateImpl::DidFinishLoad( |
| 180 int64 frame_id, | 170 int64 frame_id, |
| 181 const GURL& validated_url, | 171 const GURL& validated_url, |
| 182 bool is_main_frame, | 172 bool is_main_frame, |
| 183 content::RenderViewHost* render_view_host) { | 173 content::RenderViewHost* render_view_host) { |
| 184 if (is_main_frame) { | 174 if (is_main_frame) { |
| 185 if (!loader_->supports_instant_) | 175 if (!loader_->supports_instant_) |
| 186 Send(new ChromeViewMsg_DetermineIfPageSupportsInstant(routing_id())); | 176 Send(new ChromeViewMsg_DetermineIfPageSupportsInstant(routing_id())); |
| 187 loader_->loader_delegate_->InstantLoaderPreviewLoaded(loader_); | 177 loader_->loader_delegate_->InstantLoaderPreviewLoaded(loader_); |
| 188 } | 178 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 content::WebContents* new_contents) { | 417 content::WebContents* new_contents) { |
| 428 DCHECK(old_contents == preview_contents_->web_contents()); | 418 DCHECK(old_contents == preview_contents_->web_contents()); |
| 429 CleanupPreviewContents(); | 419 CleanupPreviewContents(); |
| 430 // We release here without deleting so that the caller still has the | 420 // We release here without deleting so that the caller still has the |
| 431 // responsibility for deleting the TabContents. | 421 // responsibility for deleting the TabContents. |
| 432 ignore_result(preview_contents_.release()); | 422 ignore_result(preview_contents_.release()); |
| 433 preview_contents_.reset(TabContents::FromWebContents(new_contents)); | 423 preview_contents_.reset(TabContents::FromWebContents(new_contents)); |
| 434 SetupPreviewContents(); | 424 SetupPreviewContents(); |
| 435 loader_delegate_->SwappedTabContents(this); | 425 loader_delegate_->SwappedTabContents(this); |
| 436 } | 426 } |
| OLD | NEW |