| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/components_ui.h" | 5 #include "chrome/browser/ui/webui/components_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 std::string component_id; | 113 std::string component_id; |
| 114 if (!args->GetString(0, &component_id)) { | 114 if (!args->GetString(0, &component_id)) { |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 return; | 116 return; |
| 117 } | 117 } |
| 118 | 118 |
| 119 ComponentsUI::OnDemandUpdate(component_id); | 119 ComponentsUI::OnDemandUpdate(component_id); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void ComponentsDOMHandler::LoadComponents() { | 122 void ComponentsDOMHandler::LoadComponents() { |
| 123 ComponentUpdateService* cus = g_browser_process->component_updater(); | 123 component_updater::ComponentUpdateService* cus = |
| 124 std::vector<CrxComponentInfo> components; | 124 g_browser_process->component_updater(); |
| 125 std::vector<component_updater::CrxComponentInfo> components; |
| 125 cus->GetComponents(&components); | 126 cus->GetComponents(&components); |
| 126 | 127 |
| 127 // Construct DictionaryValues to return to UI. | 128 // Construct DictionaryValues to return to UI. |
| 128 base::ListValue* component_list = new base::ListValue(); | 129 base::ListValue* component_list = new base::ListValue(); |
| 129 for (size_t j = 0; j < components.size(); ++j) { | 130 for (size_t j = 0; j < components.size(); ++j) { |
| 130 const CrxComponentInfo& component = components[j]; | 131 const component_updater::CrxComponentInfo& component = components[j]; |
| 131 | 132 |
| 132 base::DictionaryValue* component_entry = new base::DictionaryValue(); | 133 base::DictionaryValue* component_entry = new base::DictionaryValue(); |
| 133 component_entry->SetString("id", component.id); | 134 component_entry->SetString("id", component.id); |
| 134 component_entry->SetString("name", component.name); | 135 component_entry->SetString("name", component.name); |
| 135 component_entry->SetString("version", component.version); | 136 component_entry->SetString("version", component.version); |
| 136 | 137 |
| 137 component_list->Append(component_entry); | 138 component_list->Append(component_entry); |
| 138 } | 139 } |
| 139 | 140 |
| 140 base::DictionaryValue results; | 141 base::DictionaryValue results; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 ComponentsUI::ComponentsUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 154 ComponentsUI::ComponentsUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 154 web_ui->AddMessageHandler(new ComponentsDOMHandler()); | 155 web_ui->AddMessageHandler(new ComponentsDOMHandler()); |
| 155 | 156 |
| 156 // Set up the chrome://components/ source. | 157 // Set up the chrome://components/ source. |
| 157 Profile* profile = Profile::FromWebUI(web_ui); | 158 Profile* profile = Profile::FromWebUI(web_ui); |
| 158 content::WebUIDataSource::Add(profile, CreateComponentsUIHTMLSource()); | 159 content::WebUIDataSource::Add(profile, CreateComponentsUIHTMLSource()); |
| 159 } | 160 } |
| 160 | 161 |
| 161 // static | 162 // static |
| 162 void ComponentsUI::OnDemandUpdate(const std::string& component_id) { | 163 void ComponentsUI::OnDemandUpdate(const std::string& component_id) { |
| 163 ComponentUpdateService* cus = g_browser_process->component_updater(); | 164 component_updater::ComponentUpdateService* cus = |
| 165 g_browser_process->component_updater(); |
| 164 cus->OnDemandUpdate(component_id); | 166 cus->OnDemandUpdate(component_id); |
| 165 } | 167 } |
| 166 | 168 |
| 167 // static | 169 // static |
| 168 base::RefCountedMemory* ComponentsUI::GetFaviconResourceBytes( | 170 base::RefCountedMemory* ComponentsUI::GetFaviconResourceBytes( |
| 169 ui::ScaleFactor scale_factor) { | 171 ui::ScaleFactor scale_factor) { |
| 170 return ResourceBundle::GetSharedInstance(). | 172 return ResourceBundle::GetSharedInstance(). |
| 171 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); | 173 LoadDataResourceBytesForScale(IDR_PLUGINS_FAVICON, scale_factor); |
| 172 } | 174 } |
| OLD | NEW |