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

Side by Side Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 2601763002: WebFrame cleanup: Move addMessageToConsole to WebLocalFrame (Closed)
Patch Set: Created 3 years, 12 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 "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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 void ChromeRenderViewObserver::OnGetWebApplicationInfo() { 92 void ChromeRenderViewObserver::OnGetWebApplicationInfo() {
93 WebFrame* main_frame = render_view()->GetWebView()->mainFrame(); 93 WebFrame* main_frame = render_view()->GetWebView()->mainFrame();
94 DCHECK(main_frame); 94 DCHECK(main_frame);
95 95
96 WebApplicationInfo web_app_info; 96 WebApplicationInfo web_app_info;
97 web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info); 97 web_apps::ParseWebAppFromWebDocument(main_frame, &web_app_info);
98 98
99 // The warning below is specific to mobile but it doesn't hurt to show it even 99 // The warning below is specific to mobile but it doesn't hurt to show it even
100 // if the Chromium build is running on a desktop. It will get more exposition. 100 // if the Chromium build is running on a desktop. It will get more exposition.
101 if (web_app_info.mobile_capable == 101 // TODO(mlamouri): Associate this message with an actual frame, to avoid the
102 WebApplicationInfo::MOBILE_CAPABLE_APPLE) { 102 // need to check whether or not the main frame is local.
103 if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE &&
104 main_frame->isWebLocalFrame()) {
103 blink::WebConsoleMessage message( 105 blink::WebConsoleMessage message(
104 blink::WebConsoleMessage::LevelWarning, 106 blink::WebConsoleMessage::LevelWarning,
105 "<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is " 107 "<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is "
106 "deprecated. Please include <meta name=\"mobile-web-app-capable\" " 108 "deprecated. Please include <meta name=\"mobile-web-app-capable\" "
107 "content=\"yes\"> - " 109 "content=\"yes\"> - "
108 "http://developers.google.com/chrome/mobile/docs/installtohomescreen"); 110 "http://developers.google.com/chrome/mobile/docs/installtohomescreen");
109 main_frame->addMessageToConsole(message); 111 main_frame->toWebLocalFrame()->addMessageToConsole(message);
dcheng 2016/12/27 08:48:59 +mlamouri... is it possible for this message to be
110 } 112 }
111 113
112 // Prune out any data URLs in the set of icons. The browser process expects 114 // Prune out any data URLs in the set of icons. The browser process expects
113 // any icon with a data URL to have originated from a favicon. We don't want 115 // any icon with a data URL to have originated from a favicon. We don't want
114 // to decode arbitrary data URLs in the browser process. See 116 // to decode arbitrary data URLs in the browser process. See
115 // http://b/issue?id=1162972 117 // http://b/issue?id=1162972
116 for (std::vector<WebApplicationInfo::IconInfo>::iterator it = 118 for (std::vector<WebApplicationInfo::IconInfo>::iterator it =
117 web_app_info.icons.begin(); it != web_app_info.icons.end();) { 119 web_app_info.icons.begin(); it != web_app_info.icons.end();) {
118 if (it->url.SchemeIs(url::kDataScheme)) 120 if (it->url.SchemeIs(url::kDataScheme))
119 it = web_app_info.icons.erase(it); 121 it = web_app_info.icons.erase(it);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 !webui_javascript_.empty()) { 169 !webui_javascript_.empty()) {
168 for (const auto& script : webui_javascript_) 170 for (const auto& script : webui_javascript_)
169 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script); 171 render_view()->GetMainRenderFrame()->ExecuteJavaScript(script);
170 webui_javascript_.clear(); 172 webui_javascript_.clear();
171 } 173 }
172 } 174 }
173 175
174 void ChromeRenderViewObserver::OnDestruct() { 176 void ChromeRenderViewObserver::OnDestruct() {
175 delete this; 177 delete this;
176 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698