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 #include "chrome/browser/ui/webui/chromeos/provided_file_systems_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/provided_file_systems_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return 0; | 127 return 0; |
128 } | 128 } |
129 | 129 |
130 // Class to handle messages from chrome://provided-file-systems. | 130 // Class to handle messages from chrome://provided-file-systems. |
131 class ProvidedFileSystemsWebUIHandler | 131 class ProvidedFileSystemsWebUIHandler |
132 : public content::WebUIMessageHandler, | 132 : public content::WebUIMessageHandler, |
133 public file_system_provider::RequestManager::Observer { | 133 public file_system_provider::RequestManager::Observer { |
134 public: | 134 public: |
135 ProvidedFileSystemsWebUIHandler() : weak_ptr_factory_(this) {} | 135 ProvidedFileSystemsWebUIHandler() : weak_ptr_factory_(this) {} |
136 | 136 |
137 virtual ~ProvidedFileSystemsWebUIHandler(); | 137 ~ProvidedFileSystemsWebUIHandler() override; |
138 | 138 |
139 // RequestManager::Observer overrides. | 139 // RequestManager::Observer overrides. |
140 virtual void OnRequestCreated( | 140 void OnRequestCreated(int request_id, |
141 int request_id, | 141 file_system_provider::RequestType type) override; |
142 file_system_provider::RequestType type) override; | 142 void OnRequestDestroyed(int request_id) override; |
143 virtual void OnRequestDestroyed(int request_id) override; | 143 void OnRequestExecuted(int request_id) override; |
144 virtual void OnRequestExecuted(int request_id) override; | 144 void OnRequestFulfilled(int request_id, |
145 virtual void OnRequestFulfilled( | 145 const file_system_provider::RequestValue& result, |
146 int request_id, | 146 bool has_more) override; |
147 const file_system_provider::RequestValue& result, | 147 void OnRequestRejected(int request_id, |
148 bool has_more) override; | 148 const file_system_provider::RequestValue& result, |
149 virtual void OnRequestRejected( | 149 base::File::Error error) override; |
150 int request_id, | 150 void OnRequestTimeouted(int request_id) override; |
151 const file_system_provider::RequestValue& result, | |
152 base::File::Error error) override; | |
153 virtual void OnRequestTimeouted(int request_id) override; | |
154 | 151 |
155 private: | 152 private: |
156 // content::WebUIMessageHandler overrides. | 153 // content::WebUIMessageHandler overrides. |
157 virtual void RegisterMessages() override; | 154 void RegisterMessages() override; |
158 | 155 |
159 // Gets a file system provider service for the current profile. If not found, | 156 // Gets a file system provider service for the current profile. If not found, |
160 // then NULL. | 157 // then NULL. |
161 file_system_provider::Service* GetService(); | 158 file_system_provider::Service* GetService(); |
162 | 159 |
163 // Invoked when updating file system list is requested. | 160 // Invoked when updating file system list is requested. |
164 void UpdateFileSystems(const base::ListValue* args); | 161 void UpdateFileSystems(const base::ListValue* args); |
165 | 162 |
166 // Invoked when a file system is selected from the list. | 163 // Invoked when a file system is selected from the list. |
167 void SelectFileSystem(const base::ListValue* args); | 164 void SelectFileSystem(const base::ListValue* args); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 IDR_PROVIDED_FILE_SYSTEMS_CSS); | 355 IDR_PROVIDED_FILE_SYSTEMS_CSS); |
359 source->AddResourcePath("provided_file_systems.js", | 356 source->AddResourcePath("provided_file_systems.js", |
360 IDR_PROVIDED_FILE_SYSTEMS_JS); | 357 IDR_PROVIDED_FILE_SYSTEMS_JS); |
361 source->SetDefaultResource(IDR_PROVIDED_FILE_SYSTEMS_HTML); | 358 source->SetDefaultResource(IDR_PROVIDED_FILE_SYSTEMS_HTML); |
362 | 359 |
363 Profile* profile = Profile::FromWebUI(web_ui); | 360 Profile* profile = Profile::FromWebUI(web_ui); |
364 content::WebUIDataSource::Add(profile, source); | 361 content::WebUIDataSource::Add(profile, source); |
365 } | 362 } |
366 | 363 |
367 } // namespace chromeos | 364 } // namespace chromeos |
OLD | NEW |