Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/sync_file_system_internals/extension_statuses_ handler.h" | |
| 6 | |
| 7 #include <map> | |
| 8 | |
| 9 #include "base/bind.h" | |
| 10 #include "base/bind_helpers.h" | |
| 11 #include "base/values.h" | |
| 12 #include "chrome/browser/profiles/profile.h" | |
| 13 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | |
| 14 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" | |
| 15 #include "content/public/browser/web_ui.h" | |
| 16 #include "content/public/browser/web_ui_data_source.h" | |
| 17 #include "grit/sync_file_system_internals_resources.h" | |
| 18 | |
| 19 using sync_file_system::SyncFileSystemServiceFactory; | |
| 20 using sync_file_system::SyncServiceState; | |
| 21 | |
| 22 namespace syncfs_internals { | |
| 23 | |
| 24 ExtensionStatusesHandler::ExtensionStatusesHandler(Profile* profile) | |
| 25 : profile_(profile) {} | |
| 26 | |
| 27 ExtensionStatusesHandler::~ExtensionStatusesHandler() {} | |
| 28 | |
| 29 void ExtensionStatusesHandler::RegisterMessages() { | |
| 30 web_ui()->RegisterMessageCallback( | |
| 31 "getExtensionStatuses", | |
| 32 base::Bind(&ExtensionStatusesHandler::GetExtensionStatuses, | |
| 33 base::Unretained(this))); | |
| 34 } | |
| 35 | |
| 36 void ExtensionStatusesHandler::GetExtensionStatuses( | |
| 37 const base::ListValue* args) { | |
|
nhiroki
2013/06/07 06:31:25
Can you add "DCHECK(args);"?
calvinlo
2013/06/07 06:40:29
Done.
| |
| 38 std::map<GURL, std::string> status_map; | |
| 39 SyncFileSystemServiceFactory::GetForProfile(profile_)->GetExtensionStatusMap( | |
| 40 &status_map); | |
| 41 | |
| 42 base::ListValue list; | |
| 43 for (std::map<GURL, std::string>::const_iterator itr = status_map.begin(); | |
| 44 itr != status_map.end(); | |
| 45 ++itr) { | |
| 46 base::DictionaryValue* dict = new DictionaryValue; | |
|
nhiroki
2013/06/07 06:31:25
nit: indent
calvinlo
2013/06/07 06:40:29
Done.
| |
| 47 dict->SetString("extensionID", itr->first.spec()); | |
| 48 dict->SetString("status", itr->second); | |
| 49 list.Append(dict); | |
| 50 } | |
| 51 | |
| 52 LOG(ERROR) << "GOT TO HERE list.size=" << status_map.size(); | |
|
nhiroki
2013/06/07 06:31:25
Is this for debugging?
calvinlo
2013/06/07 06:40:29
Done. Sorry, forgot to take this out.
| |
| 53 web_ui()->CallJavascriptFunction("extensionStatuses.onGetExtensionStatuses", | |
| 54 list); | |
| 55 } | |
| 56 | |
| 57 } // namespace syncfs_internals | |
| OLD | NEW |