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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 return; | 2832 return; |
2833 } | 2833 } |
2834 if (!iter->second.is_null()) { | 2834 if (!iter->second.is_null()) { |
2835 iter->second.Run( | 2835 iter->second.Run( |
2836 id, http_status_code, image_url, bitmaps, original_bitmap_sizes); | 2836 id, http_status_code, image_url, bitmaps, original_bitmap_sizes); |
2837 } | 2837 } |
2838 image_download_map_.erase(id); | 2838 image_download_map_.erase(id); |
2839 } | 2839 } |
2840 | 2840 |
2841 void WebContentsImpl::OnUpdateFaviconURL( | 2841 void WebContentsImpl::OnUpdateFaviconURL( |
2842 int32 page_id, | |
2843 const std::vector<FaviconURL>& candidates) { | 2842 const std::vector<FaviconURL>& candidates) { |
2844 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2843 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2845 DidUpdateFaviconURL(page_id, candidates)); | 2844 DidUpdateFaviconURL(candidates)); |
2846 } | 2845 } |
2847 | 2846 |
2848 void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, | 2847 void WebContentsImpl::OnMediaPlayingNotification(int64 player_cookie, |
2849 bool has_video, | 2848 bool has_video, |
2850 bool has_audio) { | 2849 bool has_audio) { |
2851 // Chrome OS does its own detection of audio and video. | 2850 // Chrome OS does its own detection of audio and video. |
2852 #if !defined(OS_CHROMEOS) | 2851 #if !defined(OS_CHROMEOS) |
2853 scoped_ptr<PowerSaveBlocker> blocker; | 2852 scoped_ptr<PowerSaveBlocker> blocker; |
2854 if (has_video) { | 2853 if (has_video) { |
2855 blocker = PowerSaveBlocker::Create( | 2854 blocker = PowerSaveBlocker::Create( |
(...skipping 15 matching lines...) Expand all Loading... |
2871 } | 2870 } |
2872 | 2871 |
2873 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) { | 2872 void WebContentsImpl::OnMediaPausedNotification(int64 player_cookie) { |
2874 // Chrome OS does its own detection of audio and video. | 2873 // Chrome OS does its own detection of audio and video. |
2875 #if !defined(OS_CHROMEOS) | 2874 #if !defined(OS_CHROMEOS) |
2876 delete power_save_blockers_[render_frame_message_source_][player_cookie]; | 2875 delete power_save_blockers_[render_frame_message_source_][player_cookie]; |
2877 power_save_blockers_[render_frame_message_source_].erase(player_cookie); | 2876 power_save_blockers_[render_frame_message_source_].erase(player_cookie); |
2878 #endif // !defined(OS_CHROMEOS) | 2877 #endif // !defined(OS_CHROMEOS) |
2879 } | 2878 } |
2880 | 2879 |
2881 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint(int32 page_id) { | 2880 void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() { |
2882 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2881 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2883 DidFirstVisuallyNonEmptyPaint(page_id)); | 2882 DidFirstVisuallyNonEmptyPaint()); |
2884 } | 2883 } |
2885 | 2884 |
2886 void WebContentsImpl::DidChangeVisibleSSLState() { | 2885 void WebContentsImpl::DidChangeVisibleSSLState() { |
2887 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2886 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2888 DidChangeVisibleSSLState()); | 2887 DidChangeVisibleSSLState()); |
2889 } | 2888 } |
2890 | 2889 |
2891 void WebContentsImpl::NotifyBeforeFormRepostWarningShow() { | 2890 void WebContentsImpl::NotifyBeforeFormRepostWarningShow() { |
2892 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2891 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2893 BeforeFormRepostWarningShow()); | 2892 BeforeFormRepostWarningShow()); |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3482 opener_ = NULL; | 3481 opener_ = NULL; |
3483 } | 3482 } |
3484 | 3483 |
3485 // Notify all swapped out RenderViewHosts for this tab. This is important | 3484 // Notify all swapped out RenderViewHosts for this tab. This is important |
3486 // in case we go back to them, or if another window in those processes tries | 3485 // in case we go back to them, or if another window in those processes tries |
3487 // to access window.opener. | 3486 // to access window.opener. |
3488 GetRenderManager()->DidDisownOpener(render_frame_host->GetRenderViewHost()); | 3487 GetRenderManager()->DidDisownOpener(render_frame_host->GetRenderViewHost()); |
3489 } | 3488 } |
3490 | 3489 |
3491 void WebContentsImpl::DocumentOnLoadCompleted( | 3490 void WebContentsImpl::DocumentOnLoadCompleted( |
3492 RenderFrameHost* render_frame_host, | 3491 RenderFrameHost* render_frame_host) { |
3493 int32 page_id) { | |
3494 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3492 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3495 DocumentOnLoadCompletedInMainFrame(page_id)); | 3493 DocumentOnLoadCompletedInMainFrame()); |
3496 | 3494 |
3497 // TODO(avi): Remove. http://crbug.com/170921 | 3495 // TODO(avi): Remove. http://crbug.com/170921 |
3498 NotificationService::current()->Notify( | 3496 NotificationService::current()->Notify( |
3499 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 3497 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
3500 Source<WebContents>(this), | 3498 Source<WebContents>(this), |
3501 Details<int>(&page_id)); | 3499 NotificationService::NoDetails()); |
3502 } | 3500 } |
3503 | 3501 |
3504 void WebContentsImpl::DocumentAvailableInMainFrame( | 3502 void WebContentsImpl::DocumentAvailableInMainFrame( |
3505 RenderViewHost* render_view_host) { | 3503 RenderViewHost* render_view_host) { |
3506 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3504 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3507 DocumentAvailableInMainFrame()); | 3505 DocumentAvailableInMainFrame()); |
3508 } | 3506 } |
3509 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { | 3507 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { |
3510 // Tell the active RenderViewHost to run unload handlers and close, as long | 3508 // Tell the active RenderViewHost to run unload handlers and close, as long |
3511 // as the request came from a RenderViewHost in the same BrowsingInstance. | 3509 // as the request came from a RenderViewHost in the same BrowsingInstance. |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3987 | 3985 |
3988 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3986 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3989 if (!delegate_) | 3987 if (!delegate_) |
3990 return; | 3988 return; |
3991 const gfx::Size new_size = GetPreferredSize(); | 3989 const gfx::Size new_size = GetPreferredSize(); |
3992 if (new_size != old_size) | 3990 if (new_size != old_size) |
3993 delegate_->UpdatePreferredSize(this, new_size); | 3991 delegate_->UpdatePreferredSize(this, new_size); |
3994 } | 3992 } |
3995 | 3993 |
3996 } // namespace content | 3994 } // namespace content |
OLD | NEW |