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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_loader_handler.h

Issue 979453002: [Extensions] Make chrome://extensions use developerPrivate for unpacked loading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 5 years, 9 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 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 CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 explicit ExtensionLoaderHandler(Profile* profile); 38 explicit ExtensionLoaderHandler(Profile* profile);
39 ~ExtensionLoaderHandler() override; 39 ~ExtensionLoaderHandler() override;
40 40
41 // Fetches the localized values for the page and deposits them into |source|. 41 // Fetches the localized values for the page and deposits them into |source|.
42 void GetLocalizedValues(content::WebUIDataSource* source); 42 void GetLocalizedValues(content::WebUIDataSource* source);
43 43
44 // WebUIMessageHandler implementation. 44 // WebUIMessageHandler implementation.
45 void RegisterMessages() override; 45 void RegisterMessages() override;
46 46
47 private: 47 private:
48 class FileHelper;
49
50 // Handle the 'extensionLoaderLoadUnpacked' message.
51 void HandleLoadUnpacked(const base::ListValue* args);
52
53 // Handle the 'extensionLoaderRetry' message. 48 // Handle the 'extensionLoaderRetry' message.
54 void HandleRetry(const base::ListValue* args); 49 void HandleRetry(const base::ListValue* args);
55 50
56 // Handle the 'extensionLoaderIgnoreFailure' message. 51 // Handle the 'extensionLoaderIgnoreFailure' message.
57 void HandleIgnoreFailure(const base::ListValue* args); 52 void HandleIgnoreFailure(const base::ListValue* args);
58 53
59 // Handle the 'extensionLoaderDisplayFailures' message. 54 // Handle the 'extensionLoaderDisplayFailures' message.
60 void HandleDisplayFailures(const base::ListValue* args); 55 void HandleDisplayFailures(const base::ListValue* args);
61 56
62 // Try to load an unpacked extension from the given |file_path|. 57 // Try to load an unpacked extension from the given |file_path|.
63 void LoadUnpackedExtensionImpl(const base::FilePath& file_path); 58 void LoadUnpackedExtension(const base::FilePath& file_path);
64 59
65 // ExtensionErrorReporter::Observer: 60 // ExtensionErrorReporter::Observer:
66 void OnLoadFailure(content::BrowserContext* browser_context, 61 void OnLoadFailure(content::BrowserContext* browser_context,
67 const base::FilePath& file_path, 62 const base::FilePath& file_path,
68 const std::string& error) override; 63 const std::string& error) override;
69 64
70 // content::WebContentsObserver: 65 // content::WebContentsObserver:
71 void DidStartNavigationToPendingEntry( 66 void DidStartNavigationToPendingEntry(
72 const GURL& url, 67 const GURL& url,
73 content::NavigationController::ReloadType reload_type) override; 68 content::NavigationController::ReloadType reload_type) override;
74 69
75 // Add a failure to |failures_|. If it was a manifest error, |manifest| will 70 // Add a failure to |failures_|. If it was a manifest error, |manifest| will
76 // hold the manifest contents, and |line_number| will point to the line at 71 // hold the manifest contents, and |line_number| will point to the line at
77 // which the error was found. 72 // which the error was found.
78 void AddFailure(const base::FilePath& file_path, 73 void AddFailure(const base::FilePath& file_path,
79 const std::string& error, 74 const std::string& error,
80 size_t line_number, 75 size_t line_number,
81 const std::string& manifest); 76 const std::string& manifest);
82 77
83 // Notify the frontend of all failures. 78 // Notify the frontend of all failures.
84 void NotifyFrontendOfFailure(); 79 void NotifyFrontendOfFailure();
85 80
86 // The profile with which this Handler is associated. 81 // The profile with which this Handler is associated.
87 Profile* profile_; 82 Profile* profile_;
88 83
89 // A helper to manage file picking.
90 scoped_ptr<FileHelper> file_helper_;
91
92 // Holds information about all unpacked extension install failures that 84 // Holds information about all unpacked extension install failures that
93 // were reported while the extensions page was loading. 85 // were reported while the extensions page was loading.
94 base::ListValue failures_; 86 base::ListValue failures_;
95 87
96 // Holds failed paths for load retries. 88 // Holds failed paths for load retries.
97 std::vector<base::FilePath> failed_paths_; 89 std::vector<base::FilePath> failed_paths_;
98 90
99 ScopedObserver<ExtensionErrorReporter, ExtensionErrorReporter::Observer> 91 ScopedObserver<ExtensionErrorReporter, ExtensionErrorReporter::Observer>
100 extension_error_reporter_observer_; 92 extension_error_reporter_observer_;
101 93
102 // Set when the chrome://extensions page is fully loaded and the frontend is 94 // Set when the chrome://extensions page is fully loaded and the frontend is
103 // ready to receive failure notifications. We need this because the page 95 // ready to receive failure notifications. We need this because the page
104 // fails to display failures if they are sent before the Javascript is loaded. 96 // fails to display failures if they are sent before the Javascript is loaded.
105 bool ui_ready_; 97 bool ui_ready_;
106 98
107 // Weak pointer factory for posting background tasks. 99 // Weak pointer factory for posting background tasks.
108 base::WeakPtrFactory<ExtensionLoaderHandler> weak_ptr_factory_; 100 base::WeakPtrFactory<ExtensionLoaderHandler> weak_ptr_factory_;
109 101
110 DISALLOW_COPY_AND_ASSIGN(ExtensionLoaderHandler); 102 DISALLOW_COPY_AND_ASSIGN(ExtensionLoaderHandler);
111 }; 103 };
112 104
113 } // namespace extensions 105 } // namespace extensions
114 106
115 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_ 107 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_LOADER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698