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

Side by Side Diff: extensions/renderer/extension_frame_helper.cc

Issue 2656433005: Use explicit WebString conversions in extensions/ (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « extensions/renderer/dom_activity_logger.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/renderer/extension_frame_helper.h" 5 #include "extensions/renderer/extension_frame_helper.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/timer/elapsed_timer.h" 9 #include "base/timer/elapsed_timer.h"
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 // Not all frames have a valid ViewType, e.g. devtools, most GuestViews, and 44 // Not all frames have a valid ViewType, e.g. devtools, most GuestViews, and
45 // unclassified detached WebContents. 45 // unclassified detached WebContents.
46 if (frame_helper->view_type() == VIEW_TYPE_INVALID) 46 if (frame_helper->view_type() == VIEW_TYPE_INVALID)
47 return false; 47 return false;
48 48
49 // This logic matches ExtensionWebContentsObserver::GetExtensionFromFrame. 49 // This logic matches ExtensionWebContentsObserver::GetExtensionFromFrame.
50 blink::WebSecurityOrigin origin = 50 blink::WebSecurityOrigin origin =
51 frame_helper->render_frame()->GetWebFrame()->getSecurityOrigin(); 51 frame_helper->render_frame()->GetWebFrame()->getSecurityOrigin();
52 if (origin.isUnique() || 52 if (origin.isUnique() ||
53 !base::EqualsASCII(base::StringPiece16(origin.protocol()), 53 !base::EqualsASCII(origin.protocol().utf16(), kExtensionScheme) ||
54 kExtensionScheme) || 54 !base::EqualsASCII(origin.host().utf16(), match_extension_id.c_str()))
55 !base::EqualsASCII(base::StringPiece16(origin.host()),
56 match_extension_id.c_str()))
57 return false; 55 return false;
58 56
59 if (match_window_id != extension_misc::kUnknownWindowId && 57 if (match_window_id != extension_misc::kUnknownWindowId &&
60 frame_helper->browser_window_id() != match_window_id) 58 frame_helper->browser_window_id() != match_window_id)
61 return false; 59 return false;
62 60
63 if (match_tab_id != extension_misc::kUnknownTabId && 61 if (match_tab_id != extension_misc::kUnknownTabId &&
64 frame_helper->tab_id() != match_tab_id) 62 frame_helper->tab_id() != match_tab_id)
65 return false; 63 return false;
66 64
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 const base::ListValue& args) { 316 const base::ListValue& args) {
319 extension_dispatcher_->InvokeModuleSystemMethod( 317 extension_dispatcher_->InvokeModuleSystemMethod(
320 render_frame(), extension_id, module_name, function_name, args); 318 render_frame(), extension_id, module_name, function_name, args);
321 } 319 }
322 320
323 void ExtensionFrameHelper::OnDestruct() { 321 void ExtensionFrameHelper::OnDestruct() {
324 delete this; 322 delete this;
325 } 323 }
326 324
327 } // namespace extensions 325 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/dom_activity_logger.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698