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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1345873003: Expose PageImportanceSignals via WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing null check Created 5 years, 3 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
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 "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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 OnDidDisplayInsecureContent) 635 OnDidDisplayInsecureContent)
636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent, 636 IPC_MESSAGE_HANDLER(FrameHostMsg_DidRunInsecureContent,
637 OnDidRunInsecureContent) 637 OnDidRunInsecureContent)
638 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) 638 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
639 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) 639 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits)
640 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) 640 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory)
641 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler, 641 IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler,
642 OnRegisterProtocolHandler) 642 OnRegisterProtocolHandler)
643 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler, 643 IPC_MESSAGE_HANDLER(FrameHostMsg_UnregisterProtocolHandler,
644 OnUnregisterProtocolHandler) 644 OnUnregisterProtocolHandler)
645 IPC_MESSAGE_HANDLER(FrameHostMsg_UpdatePageImportanceSignals,
646 OnUpdatePageImportanceSignals)
645 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) 647 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply)
646 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) 648 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed)
647 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) 649 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend)
648 #if defined(ENABLE_PLUGINS) 650 #if defined(ENABLE_PLUGINS)
649 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated, 651 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceCreated,
650 OnPepperInstanceCreated) 652 OnPepperInstanceCreated)
651 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted, 653 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperInstanceDeleted,
652 OnPepperInstanceDeleted) 654 OnPepperInstanceDeleted)
653 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung) 655 IPC_MESSAGE_HANDLER(FrameHostMsg_PepperPluginHung, OnPepperPluginHung)
654 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed) 656 IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 #if defined(OS_WIN) 906 #if defined(OS_WIN)
905 void WebContentsImpl::SetParentNativeViewAccessible( 907 void WebContentsImpl::SetParentNativeViewAccessible(
906 gfx::NativeViewAccessible accessible_parent) { 908 gfx::NativeViewAccessible accessible_parent) {
907 accessible_parent_ = accessible_parent; 909 accessible_parent_ = accessible_parent;
908 RenderFrameHostImpl* rfh = GetMainFrame(); 910 RenderFrameHostImpl* rfh = GetMainFrame();
909 if (rfh) 911 if (rfh)
910 rfh->SetParentNativeViewAccessible(accessible_parent); 912 rfh->SetParentNativeViewAccessible(accessible_parent);
911 } 913 }
912 #endif 914 #endif
913 915
916 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const {
917 return page_importance_signals_;
918 }
919
914 const base::string16& WebContentsImpl::GetTitle() const { 920 const base::string16& WebContentsImpl::GetTitle() const {
915 // Transient entries take precedence. They are used for interstitial pages 921 // Transient entries take precedence. They are used for interstitial pages
916 // that are shown on top of existing pages. 922 // that are shown on top of existing pages.
917 NavigationEntry* entry = controller_.GetTransientEntry(); 923 NavigationEntry* entry = controller_.GetTransientEntry();
918 std::string accept_languages = 924 std::string accept_languages =
919 GetContentClient()->browser()->GetAcceptLangs( 925 GetContentClient()->browser()->GetAcceptLangs(
920 GetBrowserContext()); 926 GetBrowserContext());
921 if (entry) { 927 if (entry) {
922 return entry->GetTitleForDisplay(accept_languages); 928 return entry->GetTitleForDisplay(accept_languages);
923 } 929 }
(...skipping 2241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 return; 3171 return;
3166 3172
3167 ChildProcessSecurityPolicyImpl* policy = 3173 ChildProcessSecurityPolicyImpl* policy =
3168 ChildProcessSecurityPolicyImpl::GetInstance(); 3174 ChildProcessSecurityPolicyImpl::GetInstance();
3169 if (policy->IsPseudoScheme(protocol)) 3175 if (policy->IsPseudoScheme(protocol))
3170 return; 3176 return;
3171 3177
3172 delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture); 3178 delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture);
3173 } 3179 }
3174 3180
3181 void WebContentsImpl::OnUpdatePageImportanceSignals(
3182 const PageImportanceSignals& signals) {
3183 page_importance_signals_ = signals;
3184 }
3185
3175 void WebContentsImpl::OnFindReply(int request_id, 3186 void WebContentsImpl::OnFindReply(int request_id,
3176 int number_of_matches, 3187 int number_of_matches,
3177 const gfx::Rect& selection_rect, 3188 const gfx::Rect& selection_rect,
3178 int active_match_ordinal, 3189 int active_match_ordinal,
3179 bool final_update) { 3190 bool final_update) {
3180 if (delegate_) { 3191 if (delegate_) {
3181 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, 3192 delegate_->FindReply(this, request_id, number_of_matches, selection_rect,
3182 active_match_ordinal, final_update); 3193 active_match_ordinal, final_update);
3183 } 3194 }
3184 } 3195 }
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 return NULL; 4650 return NULL;
4640 } 4651 }
4641 4652
4642 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { 4653 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {
4643 force_disable_overscroll_content_ = force_disable; 4654 force_disable_overscroll_content_ = force_disable;
4644 if (view_) 4655 if (view_)
4645 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); 4656 view_->SetOverscrollControllerEnabled(CanOverscrollContent());
4646 } 4657 }
4647 4658
4648 } // namespace content 4659 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698