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

Unified Diff: chrome/browser/ui/webui/chromeos/fsp_internals_ui.cc

Issue 300023008: [fsp] Rename chrome://fsp-internals to chrome://provided-file-systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/chromeos/fsp_internals_ui.cc
diff --git a/chrome/browser/ui/webui/chromeos/fsp_internals_ui.cc b/chrome/browser/ui/webui/chromeos/fsp_internals_ui.cc
deleted file mode 100644
index 4246ef28ab4c0b7cc49ead4992aa81ef0219b0db..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/webui/chromeos/fsp_internals_ui.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/webui/chromeos/fsp_internals_ui.h"
-
-#include "base/bind.h"
-#include "base/memory/weak_ptr.h"
-#include "base/values.h"
-#include "chrome/browser/chromeos/file_system_provider/provided_file_system_info.h"
-#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
-#include "chrome/browser/chromeos/file_system_provider/request_manager.h"
-#include "chrome/browser/chromeos/file_system_provider/service.h"
-#include "chrome/browser/chromeos/file_system_provider/service_factory.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/web_ui.h"
-#include "content/public/browser/web_ui_data_source.h"
-#include "content/public/browser/web_ui_message_handler.h"
-#include "grit/browser_resources.h"
-
-using content::BrowserThread;
-
-namespace chromeos {
-
-namespace {
-
-// Class to handle messages from chrome://fsp-internals.
-class FSPInternalsWebUIHandler : public content::WebUIMessageHandler {
- public:
- FSPInternalsWebUIHandler() : weak_ptr_factory_(this) {}
-
- virtual ~FSPInternalsWebUIHandler() {}
-
- private:
- // content::WebUIMessageHandler overrides.
- virtual void RegisterMessages() OVERRIDE;
-
- // Gets a file system provider service for the current profile. If not found,
- // then NULL.
- file_system_provider::Service* GetService();
-
- // Invoked when updating file system list is requested.
- void OnUpdateFileSystems(const base::ListValue* args);
-
- base::WeakPtrFactory<FSPInternalsWebUIHandler> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(FSPInternalsWebUIHandler);
-};
-
-void FSPInternalsWebUIHandler::RegisterMessages() {
- web_ui()->RegisterMessageCallback(
- "updateFileSystems",
- base::Bind(&FSPInternalsWebUIHandler::OnUpdateFileSystems,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-file_system_provider::Service* FSPInternalsWebUIHandler::GetService() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- Profile* const profile = Profile::FromWebUI(web_ui());
- return file_system_provider::ServiceFactory::FindExisting(profile);
-}
-
-void FSPInternalsWebUIHandler::OnUpdateFileSystems(
- const base::ListValue* args) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- file_system_provider::Service* const service = GetService();
- if (!service)
- return;
-
- base::ListValue items;
-
- const std::vector<file_system_provider::ProvidedFileSystemInfo>
- file_system_info_list = service->GetProvidedFileSystemInfoList();
-
- for (size_t i = 0; i < file_system_info_list.size(); ++i) {
- const file_system_provider::ProvidedFileSystemInfo file_system_info =
- file_system_info_list[i];
-
- file_system_provider::ProvidedFileSystemInterface* const file_system =
- service->GetProvidedFileSystem(file_system_info.extension_id(),
- file_system_info.file_system_id());
- DCHECK(file_system);
-
- file_system_provider::RequestManager* const request_manager =
- file_system->GetRequestManager();
- DCHECK(request_manager);
-
- base::DictionaryValue* item_value = new base::DictionaryValue();
- item_value->SetString("id", file_system_info.file_system_id());
- item_value->SetString("name", file_system_info.file_system_name());
- item_value->SetString("extensionId", file_system_info.extension_id());
- item_value->SetString("mountPath",
- file_system_info.mount_path().AsUTF8Unsafe());
- item_value->SetInteger("activeRequests",
- request_manager->GetActiveRequestsForLogging());
-
- items.Append(item_value);
- }
-
- web_ui()->CallJavascriptFunction("updateFileSystems", items);
-}
-
-} // namespace
-
-FSPInternalsUI::FSPInternalsUI(content::WebUI* web_ui)
- : WebUIController(web_ui) {
- web_ui->AddMessageHandler(new FSPInternalsWebUIHandler());
-
- content::WebUIDataSource* source =
- content::WebUIDataSource::Create(chrome::kChromeUIFSPInternalsHost);
- source->AddResourcePath("fsp_internals.css", IDR_FSP_INTERNALS_CSS);
- source->AddResourcePath("fsp_internals.js", IDR_FSP_INTERNALS_JS);
- source->SetDefaultResource(IDR_FSP_INTERNALS_HTML);
-
- Profile* profile = Profile::FromWebUI(web_ui);
- content::WebUIDataSource::Add(profile, source);
-}
-
-} // namespace chromeos
« no previous file with comments | « chrome/browser/ui/webui/chromeos/fsp_internals_ui.h ('k') | chrome/browser/ui/webui/chromeos/provided_file_systems_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698