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(bool success, const std::string& data); |
| 80 |
71 // Contains extension resource built from path of file which is | 81 // Contains extension resource built from path of file which is |
72 // specified in JSON arguments. | 82 // specified in JSON arguments. |
73 extensions::ExtensionResource resource_; | 83 extensions::ExtensionResource resource_; |
74 | 84 |
75 int guest_instance_id_; | 85 int guest_instance_id_; |
76 | 86 |
77 GURL guest_src_; | 87 GURL guest_src_; |
78 | 88 |
| 89 scoped_ptr<WebUIURLFetcher> fetcher_; |
| 90 |
79 DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction); | 91 DISALLOW_COPY_AND_ASSIGN(WebViewInternalExecuteCodeFunction); |
80 }; | 92 }; |
81 | 93 |
82 class WebViewInternalExecuteScriptFunction | 94 class WebViewInternalExecuteScriptFunction |
83 : public WebViewInternalExecuteCodeFunction { | 95 : public WebViewInternalExecuteCodeFunction { |
84 public: | 96 public: |
85 WebViewInternalExecuteScriptFunction(); | 97 WebViewInternalExecuteScriptFunction(); |
86 | 98 |
87 protected: | 99 protected: |
88 ~WebViewInternalExecuteScriptFunction() override {} | 100 ~WebViewInternalExecuteScriptFunction() override {} |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 uint32 remove_mask_; | 389 uint32 remove_mask_; |
378 // Tracks any data related or parse errors. | 390 // Tracks any data related or parse errors. |
379 bool bad_message_; | 391 bool bad_message_; |
380 | 392 |
381 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction); | 393 DISALLOW_COPY_AND_ASSIGN(WebViewInternalClearDataFunction); |
382 }; | 394 }; |
383 | 395 |
384 } // namespace extensions | 396 } // namespace extensions |
385 | 397 |
386 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ | 398 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_VIEW_WEB_VIEW_INTERNAL_API_H_ |
OLD | NEW |