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

Side by Side Diff: chrome/browser/extensions/script_executor.h

Issue 226663003: Allow content script insertion on about:-URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reviewer's comments (matches->match) Created 6 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
OLDNEW
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 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 JAVASCRIPT, 42 JAVASCRIPT,
43 CSS, 43 CSS,
44 }; 44 };
45 45
46 // The scope of the script injection across the frames. 46 // The scope of the script injection across the frames.
47 enum FrameScope { 47 enum FrameScope {
48 TOP_FRAME, 48 TOP_FRAME,
49 ALL_FRAMES, 49 ALL_FRAMES,
50 }; 50 };
51 51
52 // Whether to insert the script in about: frames when its origin matches
53 // the extension's host permissions.
54 enum MatchAboutBlank {
55 MATCH_ABOUT_BLANK,
56 DONT_MATCH_ABOUT_BLANK,
not at google - send to devlin 2014/04/21 22:34:41 switch the order of these, false should have the 0
robwu 2014/04/21 23:21:46 Done.
57 };
58
52 // The type of world to inject into (main world, or its own isolated world). 59 // The type of world to inject into (main world, or its own isolated world).
53 enum WorldType { 60 enum WorldType {
54 MAIN_WORLD, 61 MAIN_WORLD,
55 ISOLATED_WORLD, 62 ISOLATED_WORLD,
56 }; 63 };
57 64
58 // The type of process the target is. 65 // The type of process the target is.
59 enum ProcessType { 66 enum ProcessType {
60 DEFAULT_PROCESS, 67 DEFAULT_PROCESS,
61 WEB_VIEW_PROCESS, 68 WEB_VIEW_PROCESS,
(...skipping 14 matching lines...) Expand all
76 // Executes a script. The arguments match ExtensionMsg_ExecuteCode_Params in 83 // Executes a script. The arguments match ExtensionMsg_ExecuteCode_Params in
77 // extension_messages.h (request_id is populated automatically). 84 // extension_messages.h (request_id is populated automatically).
78 // 85 //
79 // |callback| will always be called even if the IPC'd renderer is destroyed 86 // |callback| will always be called even if the IPC'd renderer is destroyed
80 // before a response is received (in this case the callback will be with a 87 // before a response is received (in this case the callback will be with a
81 // failure and appropriate error message). 88 // failure and appropriate error message).
82 void ExecuteScript(const std::string& extension_id, 89 void ExecuteScript(const std::string& extension_id,
83 ScriptType script_type, 90 ScriptType script_type,
84 const std::string& code, 91 const std::string& code,
85 FrameScope frame_scope, 92 FrameScope frame_scope,
93 MatchAboutBlank match_about_blank,
86 UserScript::RunLocation run_at, 94 UserScript::RunLocation run_at,
87 WorldType world_type, 95 WorldType world_type,
88 ProcessType process_type, 96 ProcessType process_type,
89 const GURL& file_url, 97 const GURL& file_url,
90 bool user_gesture, 98 bool user_gesture,
91 ResultType result_type, 99 ResultType result_type,
92 const ExecuteScriptCallback& callback); 100 const ExecuteScriptCallback& callback);
93 101
94 private: 102 private:
95 // The next value to use for request_id in ExtensionMsg_ExecuteCode_Params. 103 // The next value to use for request_id in ExtensionMsg_ExecuteCode_Params.
96 int next_request_id_; 104 int next_request_id_;
97 105
98 content::WebContents* web_contents_; 106 content::WebContents* web_contents_;
99 107
100 ObserverList<TabHelper::ScriptExecutionObserver>* script_observers_; 108 ObserverList<TabHelper::ScriptExecutionObserver>* script_observers_;
101 }; 109 };
102 110
103 } // namespace extensions 111 } // namespace extensions
104 112
105 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_ 113 #endif // CHROME_BROWSER_EXTENSIONS_SCRIPT_EXECUTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698