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

Side by Side Diff: extensions/renderer/script_injection.h

Issue 2797423002: Do not log Extensions.InjectedScriptExecutionTime histograms if script not executed (Closed)
Patch Set: comments addressed Created 3 years, 8 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 | « no previous file | extensions/renderer/script_injection.cc » ('j') | 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 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 5 #ifndef EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 6 #define EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/optional.h"
16 #include "extensions/common/user_script.h" 17 #include "extensions/common/user_script.h"
17 #include "extensions/renderer/injection_host.h" 18 #include "extensions/renderer/injection_host.h"
18 #include "extensions/renderer/script_injector.h" 19 #include "extensions/renderer/script_injector.h"
19 20
20 struct HostID; 21 struct HostID;
21 22
22 namespace content { 23 namespace content {
23 class RenderFrame; 24 class RenderFrame;
24 } 25 }
25 26
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // Resets the pointer of the injection host when the host is gone. 78 // Resets the pointer of the injection host when the host is gone.
78 void OnHostRemoved(); 79 void OnHostRemoved();
79 80
80 void invalidate_render_frame() { render_frame_ = nullptr; } 81 void invalidate_render_frame() { render_frame_ = nullptr; }
81 82
82 // Accessors. 83 // Accessors.
83 content::RenderFrame* render_frame() const { return render_frame_; } 84 content::RenderFrame* render_frame() const { return render_frame_; }
84 const HostID& host_id() const { return injection_host_->id(); } 85 const HostID& host_id() const { return injection_host_->id(); }
85 int64_t request_id() const { return request_id_; } 86 int64_t request_id() const { return request_id_; }
86 87
87 // Called when JS injection for the given frame has been completed. 88 // Called when JS injection for the given frame has been completed or
89 // cancelled.
88 void OnJsInjectionCompleted(const std::vector<v8::Local<v8::Value>>& results, 90 void OnJsInjectionCompleted(const std::vector<v8::Local<v8::Value>>& results,
89 base::TimeDelta elapsed); 91 base::Optional<base::TimeDelta> elapsed);
90 92
91 private: 93 private:
92 class FrameWatcher; 94 class FrameWatcher;
93 95
94 // Sends a message to the browser to request permission to inject. 96 // Sends a message to the browser to request permission to inject.
95 void RequestPermissionFromBrowser(); 97 void RequestPermissionFromBrowser();
96 98
97 // Injects the script. Returns INJECTION_FINISHED if injection has finished, 99 // Injects the script. Returns INJECTION_FINISHED if injection has finished,
98 // otherwise INJECTION_BLOCKED. 100 // otherwise INJECTION_BLOCKED.
99 InjectionResult Inject(ScriptsRunInfo* scripts_run_info); 101 InjectionResult Inject(ScriptsRunInfo* scripts_run_info);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 std::unique_ptr<FrameWatcher> frame_watcher_; 147 std::unique_ptr<FrameWatcher> frame_watcher_;
146 148
147 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_; 149 base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_;
148 150
149 DISALLOW_COPY_AND_ASSIGN(ScriptInjection); 151 DISALLOW_COPY_AND_ASSIGN(ScriptInjection);
150 }; 152 };
151 153
152 } // namespace extensions 154 } // namespace extensions
153 155
154 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_ 156 #endif // EXTENSIONS_RENDERER_SCRIPT_INJECTION_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/script_injection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698