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/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 bool handled = true; | 53 bool handled = true; |
54 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) | 54 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) |
55 #if !defined(OS_ANDROID) | 55 #if !defined(OS_ANDROID) |
56 IPC_MESSAGE_HANDLER(ChromeViewMsg_WebUIJavaScript, OnWebUIJavaScript) | 56 IPC_MESSAGE_HANDLER(ChromeViewMsg_WebUIJavaScript, OnWebUIJavaScript) |
57 #endif | 57 #endif |
58 #if defined(ENABLE_EXTENSIONS) | 58 #if defined(ENABLE_EXTENSIONS) |
59 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetVisuallyDeemphasized, | 59 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetVisuallyDeemphasized, |
60 OnSetVisuallyDeemphasized) | 60 OnSetVisuallyDeemphasized) |
61 #endif | 61 #endif |
62 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
63 IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateTopControlsState, | 63 IPC_MESSAGE_HANDLER(ChromeViewMsg_UpdateBrowserControlsState, |
64 OnUpdateTopControlsState) | 64 OnUpdateBrowserControlsState) |
65 #endif | 65 #endif |
66 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetWebApplicationInfo, | 66 IPC_MESSAGE_HANDLER(ChromeViewMsg_GetWebApplicationInfo, |
67 OnGetWebApplicationInfo) | 67 OnGetWebApplicationInfo) |
68 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) | 68 IPC_MESSAGE_HANDLER(ChromeViewMsg_SetWindowFeatures, OnSetWindowFeatures) |
69 IPC_MESSAGE_UNHANDLED(handled = false) | 69 IPC_MESSAGE_UNHANDLED(handled = false) |
70 IPC_END_MESSAGE_MAP() | 70 IPC_END_MESSAGE_MAP() |
71 | 71 |
72 return handled; | 72 return handled; |
73 } | 73 } |
74 | 74 |
75 #if !defined(OS_ANDROID) | 75 #if !defined(OS_ANDROID) |
76 void ChromeRenderViewObserver::OnWebUIJavaScript( | 76 void ChromeRenderViewObserver::OnWebUIJavaScript( |
77 const base::string16& javascript) { | 77 const base::string16& javascript) { |
78 webui_javascript_.push_back(javascript); | 78 webui_javascript_.push_back(javascript); |
79 } | 79 } |
80 #endif | 80 #endif |
81 | 81 |
82 #if defined(OS_ANDROID) | 82 #if defined(OS_ANDROID) |
83 void ChromeRenderViewObserver::OnUpdateTopControlsState( | 83 void ChromeRenderViewObserver::OnUpdateBrowserControlsState( |
84 content::TopControlsState constraints, | 84 content::BrowserControlsState constraints, |
85 content::TopControlsState current, | 85 content::BrowserControlsState current, |
86 bool animate) { | 86 bool animate) { |
87 render_view()->UpdateTopControlsState(constraints, current, animate); | 87 render_view()->UpdateBrowserControlsState(constraints, current, animate); |
88 } | 88 } |
89 #endif | 89 #endif |
90 | 90 |
91 void ChromeRenderViewObserver::OnGetWebApplicationInfo() { | 91 void ChromeRenderViewObserver::OnGetWebApplicationInfo() { |
92 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); | 92 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); |
93 DCHECK(main_frame); | 93 DCHECK(main_frame); |
94 | 94 |
95 WebApplicationInfo web_app_info; | 95 WebApplicationInfo web_app_info; |
96 web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info); | 96 web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info); |
97 | 97 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 !webui_javascript_.empty()) { | 166 !webui_javascript_.empty()) { |
167 for (const auto& script : webui_javascript_) | 167 for (const auto& script : webui_javascript_) |
168 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script); | 168 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script); |
169 webui_javascript_.clear(); | 169 webui_javascript_.clear(); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void ChromeRenderViewObserver::OnDestruct() { | 173 void ChromeRenderViewObserver::OnDestruct() { |
174 delete this; | 174 delete this; |
175 } | 175 } |
OLD | NEW |