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

Side by Side Diff: extensions/browser/api/execute_code_function.h

Issue 2301713002: Remove some UI->FILE->UI thread hops in ExecuteCodeFunction (Closed)
Patch Set: fix chromeos Created 4 years, 3 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ 5 #ifndef EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_
6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ 6 #define EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "extensions/browser/extension_function.h" 9 #include "extensions/browser/extension_function.h"
10 #include "extensions/browser/script_executor.h" 10 #include "extensions/browser/script_executor.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool success, 45 bool success,
46 std::unique_ptr<std::string> data); 46 std::unique_ptr<std::string> data);
47 47
48 const HostID& host_id() const { return host_id_; } 48 const HostID& host_id() const { return host_id_; }
49 void set_host_id(const HostID& host_id) { host_id_ = host_id; } 49 void set_host_id(const HostID& host_id) { host_id_ = host_id; }
50 50
51 // The injection details. 51 // The injection details.
52 std::unique_ptr<api::extension_types::InjectDetails> details_; 52 std::unique_ptr<api::extension_types::InjectDetails> details_;
53 53
54 private: 54 private:
55 // Called when contents from the file whose path is specified in JSON 55 // Retrieves GURL from filepath and optionally localizes |data|.
Devlin 2016/09/01 04:21:25 nitty nits: Retrieves the file url for the given |
lazyboy 2016/09/01 05:52:58 Done.
56 // arguments has been loaded. 56 // Localization depends on whether |requires_localization| was specified. Only
57 void DidLoadFile(bool success, std::unique_ptr<std::string> data); 57 // CSS file content needs to be localized.
58 // Runs on FILE thread.
59 void GetFileURLAndMaybeLocalize(const std::string& extension_id,
Devlin 2016/09/01 04:21:25 optional nit: Since we're renaming all these, I fi
lazyboy 2016/09/01 05:52:58 Done.
60 const base::FilePath& extension_path,
61 const std::string& extension_default_locale,
62 bool requires_localization,
63 bool success,
64 std::string* data);
58 65
59 // Runs on FILE thread. Loads message bundles for the extension and 66 // Runs on FILE thread.
60 // localizes the CSS data. Calls back DidLoadAndLocalizeFile on the UI thread. 67 void GetFileURLAndLocalizeComponentResource(
61 void GetFileURLAndLocalizeCSS(ScriptExecutor::ScriptType script_type, 68 std::unique_ptr<std::string> data,
62 std::unique_ptr<std::string> data, 69 bool requires_localization,
63 const std::string& extension_id, 70 const std::string& extension_id,
64 const base::FilePath& extension_path, 71 const base::FilePath& extension_path,
65 const std::string& extension_default_locale); 72 const std::string& extension_default_locale);
66 73
67 // Run in UI thread. Code string contains the code to be executed. Returns 74 // Run in UI thread. Code string contains the code to be executed. Returns
68 // true on success. If true is returned, this does an AddRef. 75 // true on success. If true is returned, this does an AddRef.
69 bool Execute(const std::string& code_string); 76 bool Execute(const std::string& code_string);
70 77
71 // Contains extension resource built from path of file which is 78 // Contains extension resource built from path of file which is
72 // specified in JSON arguments. 79 // specified in JSON arguments.
73 ExtensionResource resource_; 80 ExtensionResource resource_;
74 81
75 // The URL of the file being injected into the page. 82 // The URL of the file being injected into the page.
76 GURL file_url_; 83 GURL file_url_;
77 84
78 // The ID of the injection host. 85 // The ID of the injection host.
79 HostID host_id_; 86 HostID host_id_;
80 87
81 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction); 88 DISALLOW_COPY_AND_ASSIGN(ExecuteCodeFunction);
82 }; 89 };
83 90
84 } // namespace extensions 91 } // namespace extensions
85 92
86 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_ 93 #endif // EXTENSIONS_BROWSER_API_EXECUTE_CODE_FUNCTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698