OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/api/developer_private/developer_private_api. h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api. h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
10 #include "apps/shell_window.h" | 10 #include "apps/shell_window.h" |
11 #include "apps/shell_window_registry.h" | 11 #include "apps/shell_window_registry.h" |
12 #include "base/base64.h" | 12 #include "base/base64.h" |
13 #include "base/bind.h" | |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
15 #include "base/files/file_enumerator.h" | 16 #include "base/files/file_enumerator.h" |
16 #include "base/i18n/file_util_icu.h" | 17 #include "base/i18n/file_util_icu.h" |
17 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
21 #include "chrome/browser/devtools/devtools_window.h" | 22 #include "chrome/browser/devtools/devtools_window.h" |
22 #include "chrome/browser/extensions/api/developer_private/developer_private_api_ factory.h" | 23 #include "chrome/browser/extensions/api/developer_private/developer_private_api_ factory.h" |
23 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" | 24 #include "chrome/browser/extensions/api/developer_private/entry_picker.h" |
24 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 25 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
25 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" | 26 #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" |
26 #include "chrome/browser/extensions/devtools_util.h" | 27 #include "chrome/browser/extensions/devtools_util.h" |
27 #include "chrome/browser/extensions/extension_disabled_ui.h" | 28 #include "chrome/browser/extensions/extension_disabled_ui.h" |
28 #include "chrome/browser/extensions/extension_error_reporter.h" | 29 #include "chrome/browser/extensions/extension_error_reporter.h" |
29 #include "chrome/browser/extensions/extension_service.h" | 30 #include "chrome/browser/extensions/extension_service.h" |
30 #include "chrome/browser/extensions/extension_util.h" | 31 #include "chrome/browser/extensions/extension_util.h" |
31 #include "chrome/browser/extensions/unpacked_installer.h" | 32 #include "chrome/browser/extensions/unpacked_installer.h" |
32 #include "chrome/browser/extensions/updater/extension_updater.h" | 33 #include "chrome/browser/extensions/updater/extension_updater.h" |
33 #include "chrome/browser/platform_util.h" | 34 #include "chrome/browser/platform_util.h" |
34 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h" | 36 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h" |
36 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 37 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
37 #include "chrome/browser/ui/chrome_select_file_policy.h" | 38 #include "chrome/browser/ui/chrome_select_file_policy.h" |
39 #include "chrome/browser/ui/webui/extensions/extension_error_ui_util.h" | |
38 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
39 #include "chrome/common/extensions/api/developer_private.h" | 41 #include "chrome/common/extensions/api/developer_private.h" |
40 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 42 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
41 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 43 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
42 #include "chrome/common/extensions/manifest_url_handler.h" | 44 #include "chrome/common/extensions/manifest_url_handler.h" |
43 #include "chrome/common/url_constants.h" | 45 #include "chrome/common/url_constants.h" |
44 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
45 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
47 #include "content/public/browser/render_view_host.h" | 49 #include "content/public/browser/render_view_host.h" |
48 #include "content/public/browser/site_instance.h" | 50 #include "content/public/browser/site_instance.h" |
49 #include "content/public/browser/storage_partition.h" | 51 #include "content/public/browser/storage_partition.h" |
50 #include "content/public/browser/web_contents.h" | 52 #include "content/public/browser/web_contents.h" |
53 #include "extensions/browser/extension_error.h" | |
51 #include "extensions/browser/extension_registry.h" | 54 #include "extensions/browser/extension_registry.h" |
52 #include "extensions/browser/extension_system.h" | 55 #include "extensions/browser/extension_system.h" |
53 #include "extensions/browser/management_policy.h" | 56 #include "extensions/browser/management_policy.h" |
54 #include "extensions/browser/view_type_utils.h" | 57 #include "extensions/browser/view_type_utils.h" |
55 #include "extensions/common/constants.h" | 58 #include "extensions/common/constants.h" |
56 #include "extensions/common/extension_resource.h" | 59 #include "extensions/common/extension_resource.h" |
57 #include "extensions/common/extension_set.h" | 60 #include "extensions/common/extension_set.h" |
58 #include "extensions/common/install_warning.h" | 61 #include "extensions/common/install_warning.h" |
59 #include "extensions/common/manifest_handlers/background_info.h" | 62 #include "extensions/common/manifest_handlers/background_info.h" |
60 #include "extensions/common/manifest_handlers/incognito_info.h" | 63 #include "extensions/common/manifest_handlers/incognito_info.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 return GetImageURLFromData(contents); | 131 return GetImageURLFromData(contents); |
129 } | 132 } |
130 | 133 |
131 std::string GetExtensionID(const RenderViewHost* render_view_host) { | 134 std::string GetExtensionID(const RenderViewHost* render_view_host) { |
132 if (!render_view_host->GetSiteInstance()) | 135 if (!render_view_host->GetSiteInstance()) |
133 return std::string(); | 136 return std::string(); |
134 | 137 |
135 return render_view_host->GetSiteInstance()->GetSiteURL().host(); | 138 return render_view_host->GetSiteInstance()->GetSiteURL().host(); |
136 } | 139 } |
137 | 140 |
141 void SetString(base::DictionaryValue* dict, | |
142 const std::string& name, | |
143 const base::string16& value) { | |
144 dict->SetString(name, value); | |
145 } | |
146 | |
138 } // namespace | 147 } // namespace |
139 | 148 |
140 namespace AllowFileAccess = api::developer_private::AllowFileAccess; | 149 namespace AllowFileAccess = api::developer_private::AllowFileAccess; |
141 namespace AllowIncognito = api::developer_private::AllowIncognito; | 150 namespace AllowIncognito = api::developer_private::AllowIncognito; |
142 namespace ChoosePath = api::developer_private::ChoosePath; | 151 namespace ChoosePath = api::developer_private::ChoosePath; |
143 namespace Enable = api::developer_private::Enable; | 152 namespace Enable = api::developer_private::Enable; |
144 namespace GetItemsInfo = api::developer_private::GetItemsInfo; | 153 namespace GetItemsInfo = api::developer_private::GetItemsInfo; |
145 namespace Inspect = api::developer_private::Inspect; | 154 namespace Inspect = api::developer_private::Inspect; |
146 namespace PackDirectory = api::developer_private::PackDirectory; | 155 namespace PackDirectory = api::developer_private::PackDirectory; |
147 namespace Reload = api::developer_private::Reload; | 156 namespace Reload = api::developer_private::Reload; |
(...skipping 16 matching lines...) Expand all Loading... | |
164 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, | 173 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, |
165 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED | 174 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED |
166 }; | 175 }; |
167 | 176 |
168 CHECK(registrar_.IsEmpty()); | 177 CHECK(registrar_.IsEmpty()); |
169 for (size_t i = 0; i < arraysize(types); ++i) { | 178 for (size_t i = 0; i < arraysize(types); ++i) { |
170 registrar_.Add(this, | 179 registrar_.Add(this, |
171 types[i], | 180 types[i], |
172 content::Source<Profile>(profile_)); | 181 content::Source<Profile>(profile_)); |
173 } | 182 } |
183 | |
184 ErrorConsole::Get(profile)->AddObserver(this); | |
174 } | 185 } |
175 | 186 |
187 DeveloperPrivateEventRouter::~DeveloperPrivateEventRouter() { | |
188 ErrorConsole::Get(profile_)->RemoveObserver(this); | |
189 } | |
176 | 190 |
177 DeveloperPrivateEventRouter::~DeveloperPrivateEventRouter() {} | 191 void DeveloperPrivateEventRouter::AddExtensionId( |
192 const std::string& extension_id) { | |
193 extension_ids_.insert(extension_id); | |
194 } | |
195 | |
196 void DeveloperPrivateEventRouter::RemoveExtensionId( | |
197 const std::string& extension_id) { | |
198 extension_ids_.erase(extension_id); | |
199 } | |
178 | 200 |
179 void DeveloperPrivateEventRouter::Observe( | 201 void DeveloperPrivateEventRouter::Observe( |
180 int type, | 202 int type, |
181 const content::NotificationSource& source, | 203 const content::NotificationSource& source, |
182 const content::NotificationDetails& details) { | 204 const content::NotificationDetails& details) { |
183 const char* event_name = NULL; | 205 const char* event_name = NULL; |
184 Profile* profile = content::Source<Profile>(source).ptr(); | 206 Profile* profile = content::Source<Profile>(source).ptr(); |
185 CHECK(profile); | 207 CHECK(profile); |
186 CHECK(profile_->IsSameProfile(profile)); | 208 CHECK(profile_->IsSameProfile(profile)); |
187 developer::EventData event_data; | 209 developer::EventData event_data; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 event_data.item_id = extension->id(); | 247 event_data.item_id = extension->id(); |
226 | 248 |
227 scoped_ptr<base::ListValue> args(new base::ListValue()); | 249 scoped_ptr<base::ListValue> args(new base::ListValue()); |
228 args->Append(event_data.ToValue().release()); | 250 args->Append(event_data.ToValue().release()); |
229 | 251 |
230 event_name = developer_private::OnItemStateChanged::kEventName; | 252 event_name = developer_private::OnItemStateChanged::kEventName; |
231 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 253 scoped_ptr<Event> event(new Event(event_name, args.Pass())); |
232 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); | 254 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); |
233 } | 255 } |
234 | 256 |
257 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { | |
258 // We don't want to handle errors thrown by extensions subscribed to these | |
259 // events (currently only the Apps Developer Tool), because doing so risks | |
260 // entering a loop. | |
261 if (extension_ids_.find(error->extension_id()) != extension_ids_.end()) | |
262 return; | |
263 | |
264 developer::EventData event_data; | |
265 event_data.event_type = developer::EVENT_TYPE_ERROR_ADDED; | |
266 event_data.item_id = error->extension_id(); | |
267 | |
268 scoped_ptr<base::ListValue> args(new base::ListValue); | |
269 args->Append(event_data.ToValue().release()); | |
270 | |
271 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( | |
272 scoped_ptr<Event>(new Event( | |
273 developer_private::OnItemStateChanged::kEventName, args.Pass()))); | |
274 } | |
275 | |
235 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { | 276 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { |
236 last_unpacked_directory_ = path; | 277 last_unpacked_directory_ = path; |
237 } | 278 } |
238 | 279 |
239 void DeveloperPrivateAPI::RegisterNotifications() { | 280 void DeveloperPrivateAPI::RegisterNotifications() { |
240 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 281 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
241 this, developer_private::OnItemStateChanged::kEventName); | 282 this, developer_private::OnItemStateChanged::kEventName); |
242 } | 283 } |
243 | 284 |
244 DeveloperPrivateAPI::~DeveloperPrivateAPI() {} | 285 DeveloperPrivateAPI::~DeveloperPrivateAPI() {} |
245 | 286 |
246 void DeveloperPrivateAPI::Shutdown() {} | 287 void DeveloperPrivateAPI::Shutdown() {} |
247 | 288 |
248 void DeveloperPrivateAPI::OnListenerAdded( | 289 void DeveloperPrivateAPI::OnListenerAdded( |
249 const EventListenerInfo& details) { | 290 const EventListenerInfo& details) { |
250 if (!developer_private_event_router_) | 291 if (!developer_private_event_router_) { |
251 developer_private_event_router_.reset( | 292 developer_private_event_router_.reset( |
252 new DeveloperPrivateEventRouter(profile_)); | 293 new DeveloperPrivateEventRouter(profile_)); |
294 } | |
295 | |
296 developer_private_event_router_->AddExtensionId(details.extension_id); | |
253 } | 297 } |
254 | 298 |
255 void DeveloperPrivateAPI::OnListenerRemoved( | 299 void DeveloperPrivateAPI::OnListenerRemoved( |
256 const EventListenerInfo& details) { | 300 const EventListenerInfo& details) { |
257 if (!ExtensionSystem::Get(profile_)->event_router()->HasEventListener( | 301 if (!ExtensionSystem::Get(profile_)->event_router()->HasEventListener( |
258 developer_private::OnItemStateChanged::kEventName)) | 302 developer_private::OnItemStateChanged::kEventName)) { |
259 developer_private_event_router_.reset(NULL); | 303 developer_private_event_router_.reset(NULL); |
304 } else { | |
305 developer_private_event_router_->RemoveExtensionId(details.extension_id); | |
306 } | |
260 } | 307 } |
261 | 308 |
262 namespace api { | 309 namespace api { |
263 | 310 |
264 bool DeveloperPrivateAutoUpdateFunction::RunImpl() { | 311 bool DeveloperPrivateAutoUpdateFunction::RunImpl() { |
265 ExtensionUpdater* updater = GetExtensionUpdater(GetProfile()); | 312 ExtensionUpdater* updater = GetExtensionUpdater(GetProfile()); |
266 if (updater) | 313 if (updater) |
267 updater->CheckNow(ExtensionUpdater::CheckParams()); | 314 updater->CheckNow(ExtensionUpdater::CheckParams()); |
268 SetResult(new base::FundamentalValue(true)); | 315 SetResult(new base::FundamentalValue(true)); |
269 return true; | 316 return true; |
270 } | 317 } |
271 | 318 |
272 DeveloperPrivateAutoUpdateFunction::~DeveloperPrivateAutoUpdateFunction() {} | 319 DeveloperPrivateAutoUpdateFunction::~DeveloperPrivateAutoUpdateFunction() {} |
273 | 320 |
274 scoped_ptr<developer::ItemInfo> | 321 scoped_ptr<developer::ItemInfo> |
275 DeveloperPrivateGetItemsInfoFunction::CreateItemInfo( | 322 DeveloperPrivateGetItemsInfoFunction::CreateItemInfo( |
276 const Extension& item, | 323 const Extension& item, |
277 bool item_is_enabled) { | 324 bool item_is_enabled) { |
278 scoped_ptr<developer::ItemInfo> info(new developer::ItemInfo()); | 325 scoped_ptr<developer::ItemInfo> info(new developer::ItemInfo()); |
279 | 326 |
280 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); | 327 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); |
281 ExtensionService* service = system->extension_service(); | 328 ExtensionService* service = system->extension_service(); |
282 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); | 329 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); |
283 | 330 |
284 info->id = item.id(); | 331 info->id = item.id(); |
285 info->name = item.name(); | 332 info->name = item.name(); |
286 info->enabled = service->IsExtensionEnabled(info->id); | 333 info->enabled = service->IsExtensionEnabled(info->id); |
287 info->offline_enabled = OfflineEnabledInfo::IsOfflineEnabled(&item); | 334 info->offline_enabled = OfflineEnabledInfo::IsOfflineEnabled(&item); |
(...skipping 13 matching lines...) Expand all Loading... | |
301 info->type = developer::ITEM_TYPE_THEME; | 348 info->type = developer::ITEM_TYPE_THEME; |
302 } else if (item.is_extension()) { | 349 } else if (item.is_extension()) { |
303 info->type = developer::ITEM_TYPE_EXTENSION; | 350 info->type = developer::ITEM_TYPE_EXTENSION; |
304 } else { | 351 } else { |
305 NOTREACHED(); | 352 NOTREACHED(); |
306 } | 353 } |
307 | 354 |
308 if (Manifest::IsUnpackedLocation(item.location())) { | 355 if (Manifest::IsUnpackedLocation(item.location())) { |
309 info->path.reset( | 356 info->path.reset( |
310 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); | 357 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); |
311 for (std::vector<extensions::InstallWarning>::const_iterator it = | 358 // If the ErrorConsole is enabled, get the errors for the extension and add |
312 item.install_warnings().begin(); | 359 // them to the list. Otherwise, use the install warnings (using both is |
313 it != item.install_warnings().end(); ++it) { | 360 // redundant). |
314 developer::InstallWarning* warning = new developer::InstallWarning(); | 361 ErrorConsole* error_console = ErrorConsole::Get(GetProfile()); |
315 warning->message = it->message; | 362 if (error_console->enabled()) { |
316 info->install_warnings.push_back(make_linked_ptr(warning)); | 363 const ErrorList& errors = error_console->GetErrorsForExtension(item.id()); |
364 if (!errors.empty()) { | |
365 for (ErrorList::const_iterator iter = errors.begin(); | |
366 iter != errors.end(); ++iter) { | |
367 if ((*iter)->type() == ExtensionError::MANIFEST_ERROR) { | |
368 info->manifest_errors.push_back( | |
369 make_linked_ptr((*iter)->ToValue().release())); | |
370 } else { // runtime error | |
371 const RuntimeError* error = static_cast<const RuntimeError*>(*iter); | |
372 scoped_ptr<base::DictionaryValue> value = error->ToValue(); | |
373 bool can_inspect = | |
374 content::RenderViewHost::FromID( | |
375 error->render_process_id(), | |
376 error->render_view_id()) != NULL; | |
377 value->SetBoolean("canInspect", can_inspect); | |
378 info->runtime_errors.push_back(make_linked_ptr(value.release())); | |
379 } | |
380 } | |
381 } | |
382 } else { | |
383 for (std::vector<extensions::InstallWarning>::const_iterator it = | |
384 item.install_warnings().begin(); | |
385 it != item.install_warnings().end(); ++it) { | |
386 developer::InstallWarning* warning = new developer::InstallWarning(); | |
Dan Beam
2014/02/11 02:43:49
nit: arguably make this a scoped_ptr and .release(
Devlin
2014/02/11 18:41:16
Done.
| |
387 warning->message = it->message; | |
388 info->install_warnings.push_back(make_linked_ptr(warning)); | |
389 } | |
317 } | 390 } |
318 } | 391 } |
319 | 392 |
320 info->incognito_enabled = util::IsIncognitoEnabled(item.id(), GetProfile()); | 393 info->incognito_enabled = util::IsIncognitoEnabled(item.id(), GetProfile()); |
321 info->wants_file_access = item.wants_file_access(); | 394 info->wants_file_access = item.wants_file_access(); |
322 info->allow_file_access = util::AllowFileAccess(item.id(), GetProfile()); | 395 info->allow_file_access = util::AllowFileAccess(item.id(), GetProfile()); |
323 info->allow_reload = Manifest::IsUnpackedLocation(item.location()); | 396 info->allow_reload = Manifest::IsUnpackedLocation(item.location()); |
324 info->is_unpacked = Manifest::IsUnpackedLocation(item.location()); | 397 info->is_unpacked = Manifest::IsUnpackedLocation(item.location()); |
325 info->terminated = registry->terminated_extensions().Contains(item.id()); | 398 info->terminated = registry->terminated_extensions().Contains(item.id()); |
326 info->allow_incognito = item.can_be_incognito_enabled(); | 399 info->allow_incognito = item.can_be_incognito_enabled(); |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1306 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_APP); | 1379 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_APP); |
1307 SET_STRING("deleteConfirmationMessageExtension", | 1380 SET_STRING("deleteConfirmationMessageExtension", |
1308 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION); | 1381 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION); |
1309 | 1382 |
1310 // Dialog when profile is managed. | 1383 // Dialog when profile is managed. |
1311 SET_STRING("managedProfileDialogCloseButton", | 1384 SET_STRING("managedProfileDialogCloseButton", |
1312 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_CLOSE_BUTTON); | 1385 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_CLOSE_BUTTON); |
1313 SET_STRING("managedProfileDialogTitle", | 1386 SET_STRING("managedProfileDialogTitle", |
1314 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_TITLE); | 1387 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_TITLE); |
1315 SET_STRING("managedProfileDialogDescription", | 1388 SET_STRING("managedProfileDialogDescription", |
1316 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_DESCRIPTION); | 1389 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_DESCRIPTION); |
dvh
2014/02/10 20:04:04
I think that the strings above are probably deprec
Devlin
2014/02/10 22:59:41
Done.
| |
1317 | 1390 |
1318 #undef SET_STRING | 1391 #undef SET_STRING |
1392 | |
1393 error_ui_util::GetLocalizedValues( | |
1394 base::Bind(&SetString, base::Unretained(dict))); | |
dvh
2014/02/10 20:04:04
What is it used for?
--
I went through all the re
Devlin
2014/02/10 22:59:41
Woo! That makes it a little cleaner. Done.
| |
1395 | |
1319 return true; | 1396 return true; |
1320 } | 1397 } |
1321 | 1398 |
1322 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | 1399 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} |
1323 | 1400 |
1324 bool DeveloperPrivateIsProfileManagedFunction::RunImpl() { | 1401 bool DeveloperPrivateIsProfileManagedFunction::RunImpl() { |
1325 SetResult(new base::FundamentalValue(GetProfile()->IsManaged())); | 1402 SetResult(new base::FundamentalValue(GetProfile()->IsManaged())); |
1326 return true; | 1403 return true; |
1327 } | 1404 } |
1328 | 1405 |
1329 DeveloperPrivateIsProfileManagedFunction:: | 1406 DeveloperPrivateIsProfileManagedFunction:: |
1330 ~DeveloperPrivateIsProfileManagedFunction() { | 1407 ~DeveloperPrivateIsProfileManagedFunction() { |
1331 } | 1408 } |
1332 | 1409 |
1410 DeveloperPrivateRequestFileSourceFunction:: | |
1411 DeveloperPrivateRequestFileSourceFunction() {} | |
Dan Beam
2014/02/11 02:43:49
nit: indent by 4\s to show it's a continuation
Devlin
2014/02/11 18:41:16
Done in Patch Set 2.
| |
1412 | |
1413 DeveloperPrivateRequestFileSourceFunction:: | |
1414 ~DeveloperPrivateRequestFileSourceFunction() {} | |
1415 | |
1416 bool DeveloperPrivateRequestFileSourceFunction::RunImpl() { | |
1417 scoped_ptr<developer::RequestFileSource::Params> params( | |
1418 developer::RequestFileSource::Params::Create(*args_)); | |
1419 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); | |
1420 | |
1421 base::DictionaryValue* dict = NULL; | |
1422 if (!params->dict->GetAsDictionary(&dict)) { | |
1423 NOTREACHED(); | |
1424 return false; | |
1425 } | |
1426 | |
1427 AddRef(); // Balanced in LaunchCallback(). | |
1428 error_ui_util::HandleRequestFileSource( | |
1429 dict, | |
1430 GetProfile(), | |
1431 base::Bind(&DeveloperPrivateRequestFileSourceFunction::LaunchCallback, | |
1432 base::Unretained(this))); | |
1433 return true; | |
1434 } | |
1435 | |
1436 void DeveloperPrivateRequestFileSourceFunction::LaunchCallback( | |
1437 const base::DictionaryValue& results) { | |
1438 SetResult(results.DeepCopy()); | |
1439 SendResponse(true); | |
1440 Release(); // Balanced in RunImpl(). | |
1441 } | |
1442 | |
1443 DeveloperPrivateOpenDevToolsFunction::DeveloperPrivateOpenDevToolsFunction() {} | |
1444 DeveloperPrivateOpenDevToolsFunction::~DeveloperPrivateOpenDevToolsFunction() {} | |
1445 | |
1446 bool DeveloperPrivateOpenDevToolsFunction::RunImpl() { | |
1447 scoped_ptr<developer::OpenDevTools::Params> params( | |
1448 developer::OpenDevTools::Params::Create(*args_)); | |
1449 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); | |
1450 | |
1451 base::DictionaryValue* dict = NULL; | |
1452 if (!params->dict->GetAsDictionary(&dict)) { | |
1453 NOTREACHED(); | |
1454 return false; | |
1455 } | |
1456 | |
1457 error_ui_util::HandleOpenDevTools(dict); | |
1458 | |
1459 return true; | |
1460 } | |
1461 | |
1333 } // namespace api | 1462 } // namespace api |
1334 | 1463 |
1335 } // namespace extensions | 1464 } // namespace extensions |
OLD | NEW |