OLD | NEW |
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_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ |
6 #define EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ | 6 #define EXTENSIONS_BROWSER_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ |
7 | 7 |
8 #include "extensions/browser/api/capture_web_contents_function.h" | 8 #include "extensions/browser/api/capture_web_contents_function.h" |
9 #include "extensions/browser/api/execute_code_function.h" | 9 #include "extensions/browser/api/execute_code_function.h" |
10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ~WebViewInternalExecuteCodeFunction() override; | 59 ~WebViewInternalExecuteCodeFunction() override; |
60 | 60 |
61 // Initialize |details_| if it hasn't already been. | 61 // Initialize |details_| if it hasn't already been. |
62 bool Init() override; | 62 bool Init() override; |
63 bool ShouldInsertCSS() const override; | 63 bool ShouldInsertCSS() const override; |
64 bool CanExecuteScriptOnPage() override; | 64 bool CanExecuteScriptOnPage() override; |
65 // Guarded by a process ID check. | 65 // Guarded by a process ID check. |
66 extensions::ScriptExecutor* GetScriptExecutor() final; | 66 extensions::ScriptExecutor* GetScriptExecutor() final; |
67 bool IsWebView() const override; | 67 bool IsWebView() const override; |
68 const GURL& GetWebViewSrc() const override; | 68 const GURL& GetWebViewSrc() const override; |
| 69 bool LoadFile(const std::string& file) override; |
69 | 70 |
70 private: | 71 private: |
| 72 class WebUIURLFetcher; |
| 73 |
| 74 // Loads a file url on WebUI. |
| 75 bool LoadFileForWebUI(const std::string& file_src, |
| 76 const WebUILoadFileCallback& callback); |
| 77 |
| 78 // Called when the file is loaded for WebUI. |
| 79 void DidLoadFileForWebUI(const std::string& file, |
| 80 bool success, |
| 81 const std::string& data); |
| 82 |
71 // Contains extension resource built from path of file which is | 83 // Contains extension resource built from path of file which is |
72 // specified in JSON arguments. | 84 // specified in JSON arguments. |
73 extensions::ExtensionResource resource_; | 85 extensions::ExtensionResource resource_; |
74 | 86 |
75 int guest_instance_id_; | 87 int guest_instance_id_; |
76 | 88 |
77 GURL guest_src_; | 89 GURL guest_src_; |
78 | 90 |
| 91 scoped_ptr<WebUIURLFetcher> url_fetcher_; |
| 92 |
79 DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction); | 93 DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction); |
80 }; | 94 }; |
81 | 95 |
82 class WebViewInternalExecuteScriptFunction | 96 class WebViewInternalExecuteScriptFunction |
83 : public WebViewInternalExecuteCodeFunction { | 97 : public WebViewInternalExecuteCodeFunction { |
84 public: | 98 public: |
85 WebViewInternalExecuteScriptFunction(); | 99 WebViewInternalExecuteScriptFunction(); |
86 | 100 |
87 protected: | 101 protected: |
88 ~WebViewInternalExecuteScriptFunction() override {} | 102 ~WebViewInternalExecuteScriptFunction() override {} |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 uint32 remove_mask_; | 391 uint32 remove_mask_; |
378 // Tracks any data related or parse errors. | 392 // Tracks any data related or parse errors. |
379 bool bad_message_; | 393 bool bad_message_; |
380 | 394 |
381 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction); | 395 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction); |
382 }; | 396 }; |
383 | 397 |
384 } // namespace extensions | 398 } // namespace extensions |
385 | 399 |
386 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ | 400 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ |
OLD | NEW |