| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" | 27 #include "chrome/browser/ui/constrained_window_tab_helper_delegate.h" |
| 28 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 28 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 29 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" | 29 #include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h" |
| 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 30 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 31 #include "chrome/common/chrome_notification_types.h" | 31 #include "chrome/common/chrome_notification_types.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/render_messages.h" | 33 #include "chrome/common/render_messages.h" |
| 34 #include "content/browser/in_process_webkit/session_storage_namespace.h" | 34 #include "content/browser/in_process_webkit/session_storage_namespace.h" |
| 35 #include "content/browser/renderer_host/render_view_host.h" | 35 #include "content/browser/renderer_host/render_view_host.h" |
| 36 #include "content/browser/renderer_host/render_widget_host.h" | 36 #include "content/browser/renderer_host/render_widget_host.h" |
| 37 #include "content/browser/renderer_host/render_widget_host_view.h" | |
| 38 #include "content/browser/tab_contents/provisional_load_details.h" | 37 #include "content/browser/tab_contents/provisional_load_details.h" |
| 39 #include "content/public/browser/favicon_status.h" | 38 #include "content/public/browser/favicon_status.h" |
| 40 #include "content/public/browser/navigation_controller.h" | 39 #include "content/public/browser/navigation_controller.h" |
| 41 #include "content/public/browser/navigation_details.h" | 40 #include "content/public/browser/navigation_details.h" |
| 42 #include "content/public/browser/navigation_entry.h" | 41 #include "content/public/browser/navigation_entry.h" |
| 43 #include "content/public/browser/notification_details.h" | 42 #include "content/public/browser/notification_details.h" |
| 44 #include "content/public/browser/notification_observer.h" | 43 #include "content/public/browser/notification_observer.h" |
| 45 #include "content/public/browser/notification_registrar.h" | 44 #include "content/public/browser/notification_registrar.h" |
| 46 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
| 47 #include "content/public/browser/notification_source.h" | 46 #include "content/public/browser/notification_source.h" |
| 48 #include "content/public/browser/notification_types.h" | 47 #include "content/public/browser/notification_types.h" |
| 48 #include "content/public/browser/render_widget_host_view.h" |
| 49 #include "content/public/browser/web_contents.h" | 49 #include "content/public/browser/web_contents.h" |
| 50 #include "content/public/browser/web_contents_delegate.h" | 50 #include "content/public/browser/web_contents_delegate.h" |
| 51 #include "content/public/browser/web_contents_view.h" | 51 #include "content/public/browser/web_contents_view.h" |
| 52 #include "net/http/http_util.h" | 52 #include "net/http/http_util.h" |
| 53 #include "ui/base/l10n/l10n_util.h" | 53 #include "ui/base/l10n/l10n_util.h" |
| 54 #include "ui/gfx/codec/png_codec.h" | 54 #include "ui/gfx/codec/png_codec.h" |
| 55 | 55 |
| 56 using content::NavigationController; | 56 using content::NavigationController; |
| 57 using content::NavigationEntry; | 57 using content::NavigationEntry; |
| 58 using content::WebContents; | 58 using content::WebContents; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 void InstantLoader::TabContentsDelegateImpl::NavigationStateChanged( | 439 void InstantLoader::TabContentsDelegateImpl::NavigationStateChanged( |
| 440 const WebContents* source, | 440 const WebContents* source, |
| 441 unsigned changed_flags) { | 441 unsigned changed_flags) { |
| 442 if (!loader_->ready() && !registered_render_widget_host_ && | 442 if (!loader_->ready() && !registered_render_widget_host_ && |
| 443 source->GetController().GetEntryCount()) { | 443 source->GetController().GetEntryCount()) { |
| 444 // The load has been committed. Install an observer that waits for the | 444 // The load has been committed. Install an observer that waits for the |
| 445 // first paint then makes the preview active. We wait for the load to be | 445 // first paint then makes the preview active. We wait for the load to be |
| 446 // committed before waiting on paint as there is always an initial paint | 446 // committed before waiting on paint as there is always an initial paint |
| 447 // when a new renderer is created from the resize so that if we showed the | 447 // when a new renderer is created from the resize so that if we showed the |
| 448 // preview after the first paint we would end up with a white rect. | 448 // preview after the first paint we would end up with a white rect. |
| 449 RenderWidgetHostView *rwhv = source->GetRenderWidgetHostView(); | 449 content::RenderWidgetHostView *rwhv = source->GetRenderWidgetHostView(); |
| 450 if (rwhv) | 450 if (rwhv) |
| 451 RegisterForPaintNotifications(rwhv->GetRenderWidgetHost()); | 451 RegisterForPaintNotifications(rwhv->GetRenderWidgetHost()); |
| 452 } else if (source->IsCrashed()) { | 452 } else if (source->IsCrashed()) { |
| 453 PreviewPainted(); | 453 PreviewPainted(); |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 | 456 |
| 457 void InstantLoader::TabContentsDelegateImpl::AddNavigationHeaders( | 457 void InstantLoader::TabContentsDelegateImpl::AddNavigationHeaders( |
| 458 const GURL& url, | 458 const GURL& url, |
| 459 std::string* headers) { | 459 std::string* headers) { |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 host->Send(new ChromeViewMsg_SearchBoxResize( | 1122 host->Send(new ChromeViewMsg_SearchBoxResize( |
| 1123 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); | 1123 host->routing_id(), GetOmniboxBoundsInTermsOfPreview())); |
| 1124 } else { | 1124 } else { |
| 1125 host->Send(new ChromeViewMsg_SearchBoxChange( | 1125 host->Send(new ChromeViewMsg_SearchBoxChange( |
| 1126 host->routing_id(), user_text, verbatim, 0, 0)); | 1126 host->routing_id(), user_text, verbatim, 0, 0)); |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 frame_load_observer_.reset(new FrameLoadObserver( | 1129 frame_load_observer_.reset(new FrameLoadObserver( |
| 1130 this, preview_contents()->web_contents(), user_text, verbatim)); | 1130 this, preview_contents()->web_contents(), user_text, verbatim)); |
| 1131 } | 1131 } |
| OLD | NEW |