OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/frame_host/data_url_navigation_throttle.h" | 5 #include "content/browser/frame_host/data_url_navigation_throttle.h" |
6 | 6 |
7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 return PROCEED; | 37 return PROCEED; |
38 | 38 |
39 RenderFrameHost* top_frame = | 39 RenderFrameHost* top_frame = |
40 handle->frame_tree_node()->frame_tree()->root()->current_frame_host(); | 40 handle->frame_tree_node()->frame_tree()->root()->current_frame_host(); |
41 top_frame->AddMessageToConsole( | 41 top_frame->AddMessageToConsole( |
42 CONSOLE_MESSAGE_LEVEL_ERROR, | 42 CONSOLE_MESSAGE_LEVEL_ERROR, |
43 base::StringPrintf(kConsoleError, handle->GetURL().spec().c_str())); | 43 base::StringPrintf(kConsoleError, handle->GetURL().spec().c_str())); |
44 return CANCEL; | 44 return CANCEL; |
45 } | 45 } |
46 | 46 |
| 47 const char* DataUrlNavigationThrottle::GetNameForLogging() { |
| 48 return "DataUrlNavigationThrottle"; |
| 49 } |
| 50 |
47 // static | 51 // static |
48 std::unique_ptr<NavigationThrottle> | 52 std::unique_ptr<NavigationThrottle> |
49 DataUrlNavigationThrottle::CreateThrottleForNavigation( | 53 DataUrlNavigationThrottle::CreateThrottleForNavigation( |
50 NavigationHandle* navigation_handle) { | 54 NavigationHandle* navigation_handle) { |
51 if (navigation_handle->GetURL().SchemeIs(url::kDataScheme) && | 55 if (navigation_handle->GetURL().SchemeIs(url::kDataScheme) && |
52 navigation_handle->IsInMainFrame() && | 56 navigation_handle->IsInMainFrame() && |
53 navigation_handle->IsRendererInitiated() && | 57 navigation_handle->IsRendererInitiated() && |
54 !navigation_handle->IsSameDocument() && | 58 !navigation_handle->IsSameDocument() && |
55 !base::FeatureList::IsEnabled( | 59 !base::FeatureList::IsEnabled( |
56 features::kAllowContentInitiatedDataUrlNavigations)) { | 60 features::kAllowContentInitiatedDataUrlNavigations)) { |
57 return base::MakeUnique<DataUrlNavigationThrottle>(navigation_handle); | 61 return base::MakeUnique<DataUrlNavigationThrottle>(navigation_handle); |
58 } | 62 } |
59 return nullptr; | 63 return nullptr; |
60 } | 64 } |
61 | 65 |
62 } // namespace content | 66 } // namespace content |
OLD | NEW |