Chromium Code Reviews| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 item_list.push_back(item); | 761 item_list.push_back(item); |
| 762 } | 762 } |
| 763 | 763 |
| 764 WebDragData result; | 764 WebDragData result; |
| 765 result.initialize(); | 765 result.initialize(); |
| 766 result.setItems(item_list); | 766 result.setItems(item_list); |
| 767 result.setFilesystemId(drop_data.filesystem_id); | 767 result.setFilesystemId(drop_data.filesystem_id); |
| 768 return result; | 768 return result; |
| 769 } | 769 } |
| 770 | 770 |
| 771 bool IsSourceFromExtension(const std::string& source) { | |
| 772 static const char schema_delimeter[] = "://"; | |
|
Yoyo Zhou
2013/07/10 23:39:10
kStandardSchemeSeparator
Devlin
2013/07/11 00:55:35
Much less cringe-worthy, but not needed if we go w
| |
| 773 static const char extension_url_prefix[] = "chrome-extension://"; | |
|
Matt Perry
2013/07/10 23:43:13
This is defined in https://code.google.com/p/chrom
Devlin
2013/07/11 00:55:35
I was wondering about that, but saw other referenc
| |
| 774 return !source.empty() && | |
| 775 (source.find(schema_delimeter) == std::string::npos || | |
|
Yoyo Zhou
2013/07/10 23:39:10
Can you document why these are the cases we care a
Devlin
2013/07/11 00:55:35
Done.
| |
| 776 source.find(extension_url_prefix) == 0); | |
| 777 } | |
| 778 | |
| 771 } // namespace | 779 } // namespace |
| 772 | 780 |
| 773 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) | 781 RenderViewImpl::RenderViewImpl(RenderViewImplParams* params) |
| 774 : RenderWidget(WebKit::WebPopupTypeNone, | 782 : RenderWidget(WebKit::WebPopupTypeNone, |
| 775 params->screen_info, | 783 params->screen_info, |
| 776 params->swapped_out), | 784 params->swapped_out), |
| 777 webkit_preferences_(params->webkit_prefs), | 785 webkit_preferences_(params->webkit_prefs), |
| 778 send_content_state_immediately_(false), | 786 send_content_state_immediately_(false), |
| 779 enabled_bindings_(0), | 787 enabled_bindings_(0), |
| 780 send_preferred_size_changes_(false), | 788 send_preferred_size_changes_(false), |
| (...skipping 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2260 NOTREACHED(); | 2268 NOTREACHED(); |
| 2261 } | 2269 } |
| 2262 | 2270 |
| 2263 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, | 2271 Send(new ViewHostMsg_AddMessageToConsole(routing_id_, |
| 2264 static_cast<int32>(log_severity), | 2272 static_cast<int32>(log_severity), |
| 2265 message.text, | 2273 message.text, |
| 2266 static_cast<int32>(source_line), | 2274 static_cast<int32>(source_line), |
| 2267 source_name)); | 2275 source_name)); |
| 2268 } | 2276 } |
| 2269 | 2277 |
| 2278 bool RenderViewImpl::shouldReportDetailedMessage(const WebString& source) { | |
|
Matt Perry
2013/07/10 23:43:13
Why is source a string and not a URL? It would be
Devlin
2013/07/11 00:55:35
Well, it comes from WebKit, and is a String in mos
| |
| 2279 return IsSourceFromExtension(source.utf8().data()); | |
| 2280 } | |
| 2281 | |
| 2282 void RenderViewImpl::reportDetailedMessage(const WebString& source, | |
| 2283 WebConsoleMessage::Level level, | |
| 2284 const WebString& message, | |
| 2285 const WebString& jsonStackTrace) { | |
| 2286 LOG(WARNING) << "RenderViewImpl::reportDetailedErrorMessage()" | |
| 2287 << "\n Source: " << base::string16(source) | |
| 2288 << "\n Message: " << base::string16(message) | |
| 2289 << "\n Stack: " << base::string16(jsonStackTrace); | |
| 2290 } | |
| 2291 | |
| 2270 void RenderViewImpl::printPage(WebFrame* frame) { | 2292 void RenderViewImpl::printPage(WebFrame* frame) { |
| 2271 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 2293 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 2272 PrintPage(frame, handling_input_event_)); | 2294 PrintPage(frame, handling_input_event_)); |
| 2273 } | 2295 } |
| 2274 | 2296 |
| 2275 WebKit::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { | 2297 WebKit::WebNotificationPresenter* RenderViewImpl::notificationPresenter() { |
| 2276 return notification_provider_; | 2298 return notification_provider_; |
| 2277 } | 2299 } |
| 2278 | 2300 |
| 2279 bool RenderViewImpl::enumerateChosenDirectory( | 2301 bool RenderViewImpl::enumerateChosenDirectory( |
| (...skipping 4531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6811 WebURL url = icon_urls[i].iconURL(); | 6833 WebURL url = icon_urls[i].iconURL(); |
| 6812 if (!url.isEmpty()) | 6834 if (!url.isEmpty()) |
| 6813 urls.push_back(FaviconURL(url, | 6835 urls.push_back(FaviconURL(url, |
| 6814 ToFaviconType(icon_urls[i].iconType()))); | 6836 ToFaviconType(icon_urls[i].iconType()))); |
| 6815 } | 6837 } |
| 6816 SendUpdateFaviconURL(urls); | 6838 SendUpdateFaviconURL(urls); |
| 6817 } | 6839 } |
| 6818 | 6840 |
| 6819 | 6841 |
| 6820 } // namespace content | 6842 } // namespace content |
| OLD | NEW |