This patch makes the brand color change message available for WebContents Observer.

BUG=381447

Review URL: https://codereview.chromium.org/331793005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278792 0039d316-1c4b-4281-b951-d872f2087c98
parent d228aeec
......@@ -509,6 +509,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
IPC_MESSAGE_HANDLER(FrameHostMsg_PluginCrashed, OnPluginCrashed)
IPC_MESSAGE_HANDLER(FrameHostMsg_DomOperationResponse,
OnDomOperationResponse)
IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeBrandColor,
OnBrandColorChanged)
IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishDocumentLoad,
OnDocumentLoadedInFrame)
IPC_MESSAGE_HANDLER(FrameHostMsg_DidFinishLoad, OnDidFinishLoad)
......@@ -2512,6 +2514,11 @@ bool WebContentsImpl::CanOverscrollContent() const {
return false;
}
void WebContentsImpl::OnBrandColorChanged(SkColor brand_color) {
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
DidChangeBrandColor(brand_color));
}
void WebContentsImpl::OnDidLoadResourceFromMemoryCache(
const GURL& url,
const std::string& security_info,
......
......@@ -697,6 +697,7 @@ class CONTENT_EXPORT WebContentsImpl
const IPC::Message& message);
// IPC message handlers.
void OnBrandColorChanged(SkColor brand_color);
void OnDidLoadResourceFromMemoryCache(const GURL& url,
const std::string& security_info,
const std::string& http_request,
......
......@@ -613,6 +613,10 @@ IPC_MESSAGE_ROUTED3(FrameHostMsg_MediaPlayingNotification,
IPC_MESSAGE_ROUTED1(FrameHostMsg_MediaPausedNotification,
int64 /* player_cookie, distinguishes instances */)
// Notify browser the brand color has been changed.
IPC_MESSAGE_ROUTED1(FrameHostMsg_DidChangeBrandColor,
SkColor /* brand_color */)
// Response for FrameMsg_TextSurroundingSelectionRequest, |startOffset| and
// |endOffset| are the offsets of the selection in the returned |content|.
IPC_MESSAGE_ROUTED3(FrameHostMsg_TextSurroundingSelectionResponse,
......
......@@ -13,6 +13,7 @@
#include "content/public/common/page_transition_types.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/window_open_disposition.h"
namespace content {
......@@ -328,6 +329,9 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener,
virtual void AccessibilityEventReceived(
const std::vector<AXEventNotificationDetails>& details) {}
// Invoked when brand color is changed to |brand_color|.
virtual void DidChangeBrandColor(SkColor brand_color) {}
// Invoked if an IPC message is coming from a specific RenderFrameHost.
virtual bool OnMessageReceived(const IPC::Message& message,
RenderFrameHost* render_frame_host);
......
......@@ -2207,6 +2207,14 @@ void RenderFrameImpl::didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) {
render_view_->didUpdateCurrentHistoryItem(frame);
}
void RenderFrameImpl::didChangeBrandColor() {
if (frame_->parent())
return;
Send(new FrameHostMsg_DidChangeBrandColor(
routing_id_, frame_->document().brandColor()));
}
blink::WebNotificationPresenter* RenderFrameImpl::notificationPresenter() {
return notification_provider_;
}
......
......@@ -309,6 +309,7 @@ class CONTENT_EXPORT RenderFrameImpl
const blink::WebHistoryItem& item,
blink::WebHistoryCommitType commit_type);
virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
virtual void didChangeBrandColor();
virtual blink::WebNotificationPresenter* notificationPresenter();
virtual void didChangeSelection(bool is_empty_selection);
virtual blink::WebColorChooser* createColorChooser(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment