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

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

Issue 1461163002: Use std::tie() for operator< in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/common/permissions/usb_device_permission_data.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/user_script_injector.h" 5 #include "extensions/renderer/user_script_injector.h"
6 6
7 #include <tuple>
7 #include <vector> 8 #include <vector>
8 9
9 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
10 #include "content/public/common/url_constants.h" 11 #include "content/public/common/url_constants.h"
11 #include "content/public/renderer/render_thread.h" 12 #include "content/public/renderer/render_thread.h"
12 #include "content/public/renderer/render_frame.h" 13 #include "content/public/renderer/render_frame.h"
13 #include "content/public/renderer/render_view.h" 14 #include "content/public/renderer/render_view.h"
14 #include "extensions/common/extension.h" 15 #include "extensions/common/extension.h"
15 #include "extensions/common/guest_view/extensions_guest_view_messages.h" 16 #include "extensions/common/guest_view/extensions_guest_view_messages.h"
16 #include "extensions/common/permissions/permissions_data.h" 17 #include "extensions/common/permissions/permissions_data.h"
(...skipping 12 matching lines...) Expand all
29 namespace { 30 namespace {
30 31
31 struct RoutingInfoKey { 32 struct RoutingInfoKey {
32 int routing_id; 33 int routing_id;
33 int script_id; 34 int script_id;
34 35
35 RoutingInfoKey(int routing_id, int script_id) 36 RoutingInfoKey(int routing_id, int script_id)
36 : routing_id(routing_id), script_id(script_id) {} 37 : routing_id(routing_id), script_id(script_id) {}
37 38
38 bool operator<(const RoutingInfoKey& other) const { 39 bool operator<(const RoutingInfoKey& other) const {
39 if (routing_id != other.routing_id) 40 return std::tie(routing_id, script_id) <
40 return routing_id < other.routing_id; 41 std::tie(other.routing_id, other.script_id);
41
42 if (script_id != other.script_id)
43 return script_id < other.script_id;
44 return false; // keys are equal.
45 } 42 }
46 }; 43 };
47 44
48 using RoutingInfoMap = std::map<RoutingInfoKey, bool>; 45 using RoutingInfoMap = std::map<RoutingInfoKey, bool>;
49 46
50 // These two strings are injected before and after the Greasemonkey API and 47 // These two strings are injected before and after the Greasemonkey API and
51 // user script to wrap it in an anonymous scope. 48 // user script to wrap it in an anonymous scope.
52 const char kUserScriptHead[] = "(function (unsafeWindow) {\n"; 49 const char kUserScriptHead[] = "(function (unsafeWindow) {\n";
53 const char kUserScriptTail[] = "\n})(window);"; 50 const char kUserScriptTail[] = "\n})(window);";
54 51
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 scoped_ptr<base::Value> execution_result, 259 scoped_ptr<base::Value> execution_result,
263 UserScript::RunLocation run_location, 260 UserScript::RunLocation run_location,
264 content::RenderFrame* render_frame) { 261 content::RenderFrame* render_frame) {
265 } 262 }
266 263
267 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason, 264 void UserScriptInjector::OnWillNotInject(InjectFailureReason reason,
268 content::RenderFrame* render_frame) { 265 content::RenderFrame* render_frame) {
269 } 266 }
270 267
271 } // namespace extensions 268 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/usb_device_permission_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698