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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
148 | 151 |
149 DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) { | 152 DeveloperPrivateAPI* DeveloperPrivateAPI::Get(Profile* profile) { |
150 return DeveloperPrivateAPIFactory::GetForProfile(profile); | 153 return DeveloperPrivateAPIFactory::GetForProfile(profile); |
151 } | 154 } |
152 | 155 |
153 DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) { | 156 DeveloperPrivateAPI::DeveloperPrivateAPI(Profile* profile) : profile_(profile) { |
154 RegisterNotifications(); | 157 RegisterNotifications(); |
155 } | 158 } |
156 | 159 |
157 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) | 160 DeveloperPrivateEventRouter::DeveloperPrivateEventRouter(Profile* profile) |
158 : profile_(profile) { | 161 : profile_(profile) { |
Finnur
2014/02/11 13:11:28
nit: Indentation is off here.
Devlin
2014/02/11 18:41:16
Done.
| |
159 int types[] = { | 162 int types[] = { |
160 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 163 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
161 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 164 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
162 chrome::NOTIFICATION_EXTENSION_LOADED, | 165 chrome::NOTIFICATION_EXTENSION_LOADED, |
163 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 166 chrome::NOTIFICATION_EXTENSION_UNLOADED, |
164 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, | 167 chrome::NOTIFICATION_EXTENSION_VIEW_REGISTERED, |
165 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED | 168 chrome::NOTIFICATION_EXTENSION_VIEW_UNREGISTERED |
166 }; | 169 }; |
167 | 170 |
168 CHECK(registrar_.IsEmpty()); | 171 CHECK(registrar_.IsEmpty()); |
169 for (size_t i = 0; i < arraysize(types); ++i) { | 172 for (size_t i = 0; i < arraysize(types); ++i) { |
170 registrar_.Add(this, | 173 registrar_.Add(this, |
171 types[i], | 174 types[i], |
172 content::Source<Profile>(profile_)); | 175 content::Source<Profile>(profile_)); |
173 } | 176 } |
177 | |
178 ErrorConsole::Get(profile)->AddObserver(this); | |
174 } | 179 } |
175 | 180 |
181 DeveloperPrivateEventRouter::~DeveloperPrivateEventRouter() { | |
182 ErrorConsole::Get(profile_)->RemoveObserver(this); | |
183 } | |
176 | 184 |
177 DeveloperPrivateEventRouter::~DeveloperPrivateEventRouter() {} | 185 void DeveloperPrivateEventRouter::AddExtensionId( |
186 const std::string& extension_id) { | |
187 extension_ids_.insert(extension_id); | |
188 } | |
189 | |
190 void DeveloperPrivateEventRouter::RemoveExtensionId( | |
191 const std::string& extension_id) { | |
192 extension_ids_.erase(extension_id); | |
193 } | |
178 | 194 |
179 void DeveloperPrivateEventRouter::Observe( | 195 void DeveloperPrivateEventRouter::Observe( |
180 int type, | 196 int type, |
181 const content::NotificationSource& source, | 197 const content::NotificationSource& source, |
182 const content::NotificationDetails& details) { | 198 const content::NotificationDetails& details) { |
183 const char* event_name = NULL; | 199 const char* event_name = NULL; |
184 Profile* profile = content::Source<Profile>(source).ptr(); | 200 Profile* profile = content::Source<Profile>(source).ptr(); |
185 CHECK(profile); | 201 CHECK(profile); |
186 CHECK(profile_->IsSameProfile(profile)); | 202 CHECK(profile_->IsSameProfile(profile)); |
187 developer::EventData event_data; | 203 developer::EventData event_data; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 event_data.item_id = extension->id(); | 241 event_data.item_id = extension->id(); |
226 | 242 |
227 scoped_ptr<base::ListValue> args(new base::ListValue()); | 243 scoped_ptr<base::ListValue> args(new base::ListValue()); |
228 args->Append(event_data.ToValue().release()); | 244 args->Append(event_data.ToValue().release()); |
229 | 245 |
230 event_name = developer_private::OnItemStateChanged::kEventName; | 246 event_name = developer_private::OnItemStateChanged::kEventName; |
231 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 247 scoped_ptr<Event> event(new Event(event_name, args.Pass())); |
232 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); | 248 ExtensionSystem::Get(profile)->event_router()->BroadcastEvent(event.Pass()); |
233 } | 249 } |
234 | 250 |
251 void DeveloperPrivateEventRouter::OnErrorAdded(const ExtensionError* error) { | |
252 // We don't want to handle errors thrown by extensions subscribed to these | |
253 // events (currently only the Apps Developer Tool), because doing so risks | |
254 // entering a loop. | |
255 if (extension_ids_.find(error->extension_id()) != extension_ids_.end()) | |
256 return; | |
257 | |
258 developer::EventData event_data; | |
259 event_data.event_type = developer::EVENT_TYPE_ERROR_ADDED; | |
260 event_data.item_id = error->extension_id(); | |
261 | |
262 scoped_ptr<base::ListValue> args(new base::ListValue); | |
263 args->Append(event_data.ToValue().release()); | |
264 | |
265 ExtensionSystem::Get(profile_)->event_router()->BroadcastEvent( | |
266 scoped_ptr<Event>(new Event( | |
267 developer_private::OnItemStateChanged::kEventName, args.Pass()))); | |
268 } | |
269 | |
235 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { | 270 void DeveloperPrivateAPI::SetLastUnpackedDirectory(const base::FilePath& path) { |
236 last_unpacked_directory_ = path; | 271 last_unpacked_directory_ = path; |
237 } | 272 } |
238 | 273 |
239 void DeveloperPrivateAPI::RegisterNotifications() { | 274 void DeveloperPrivateAPI::RegisterNotifications() { |
240 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( | 275 ExtensionSystem::Get(profile_)->event_router()->RegisterObserver( |
241 this, developer_private::OnItemStateChanged::kEventName); | 276 this, developer_private::OnItemStateChanged::kEventName); |
242 } | 277 } |
243 | 278 |
244 DeveloperPrivateAPI::~DeveloperPrivateAPI() {} | 279 DeveloperPrivateAPI::~DeveloperPrivateAPI() {} |
245 | 280 |
246 void DeveloperPrivateAPI::Shutdown() {} | 281 void DeveloperPrivateAPI::Shutdown() {} |
247 | 282 |
248 void DeveloperPrivateAPI::OnListenerAdded( | 283 void DeveloperPrivateAPI::OnListenerAdded( |
249 const EventListenerInfo& details) { | 284 const EventListenerInfo& details) { |
250 if (!developer_private_event_router_) | 285 if (!developer_private_event_router_) { |
251 developer_private_event_router_.reset( | 286 developer_private_event_router_.reset( |
252 new DeveloperPrivateEventRouter(profile_)); | 287 new DeveloperPrivateEventRouter(profile_)); |
288 } | |
289 | |
290 developer_private_event_router_->AddExtensionId(details.extension_id); | |
253 } | 291 } |
254 | 292 |
255 void DeveloperPrivateAPI::OnListenerRemoved( | 293 void DeveloperPrivateAPI::OnListenerRemoved( |
256 const EventListenerInfo& details) { | 294 const EventListenerInfo& details) { |
257 if (!ExtensionSystem::Get(profile_)->event_router()->HasEventListener( | 295 if (!ExtensionSystem::Get(profile_)->event_router()->HasEventListener( |
258 developer_private::OnItemStateChanged::kEventName)) | 296 developer_private::OnItemStateChanged::kEventName)) { |
259 developer_private_event_router_.reset(NULL); | 297 developer_private_event_router_.reset(NULL); |
298 } else { | |
299 developer_private_event_router_->RemoveExtensionId(details.extension_id); | |
300 } | |
260 } | 301 } |
261 | 302 |
262 namespace api { | 303 namespace api { |
263 | 304 |
264 bool DeveloperPrivateAutoUpdateFunction::RunImpl() { | 305 bool DeveloperPrivateAutoUpdateFunction::RunImpl() { |
265 ExtensionUpdater* updater = GetExtensionUpdater(GetProfile()); | 306 ExtensionUpdater* updater = GetExtensionUpdater(GetProfile()); |
266 if (updater) | 307 if (updater) |
267 updater->CheckNow(ExtensionUpdater::CheckParams()); | 308 updater->CheckNow(ExtensionUpdater::CheckParams()); |
268 SetResult(new base::FundamentalValue(true)); | 309 SetResult(new base::FundamentalValue(true)); |
269 return true; | 310 return true; |
270 } | 311 } |
271 | 312 |
272 DeveloperPrivateAutoUpdateFunction::~DeveloperPrivateAutoUpdateFunction() {} | 313 DeveloperPrivateAutoUpdateFunction::~DeveloperPrivateAutoUpdateFunction() {} |
273 | 314 |
274 scoped_ptr<developer::ItemInfo> | 315 scoped_ptr<developer::ItemInfo> |
275 DeveloperPrivateGetItemsInfoFunction::CreateItemInfo( | 316 DeveloperPrivateGetItemsInfoFunction::CreateItemInfo(const Extension& item, |
276 const Extension& item, | 317 bool item_is_enabled) { |
277 bool item_is_enabled) { | |
278 scoped_ptr<developer::ItemInfo> info(new developer::ItemInfo()); | 318 scoped_ptr<developer::ItemInfo> info(new developer::ItemInfo()); |
279 | 319 |
280 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); | 320 ExtensionSystem* system = ExtensionSystem::Get(GetProfile()); |
281 ExtensionService* service = system->extension_service(); | 321 ExtensionService* service = system->extension_service(); |
282 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); | 322 ExtensionRegistry* registry = ExtensionRegistry::Get(GetProfile()); |
283 | 323 |
284 info->id = item.id(); | 324 info->id = item.id(); |
285 info->name = item.name(); | 325 info->name = item.name(); |
286 info->enabled = service->IsExtensionEnabled(info->id); | 326 info->enabled = service->IsExtensionEnabled(info->id); |
287 info->offline_enabled = OfflineEnabledInfo::IsOfflineEnabled(&item); | 327 info->offline_enabled = OfflineEnabledInfo::IsOfflineEnabled(&item); |
(...skipping 13 matching lines...) Expand all Loading... | |
301 info->type = developer::ITEM_TYPE_THEME; | 341 info->type = developer::ITEM_TYPE_THEME; |
302 } else if (item.is_extension()) { | 342 } else if (item.is_extension()) { |
303 info->type = developer::ITEM_TYPE_EXTENSION; | 343 info->type = developer::ITEM_TYPE_EXTENSION; |
304 } else { | 344 } else { |
305 NOTREACHED(); | 345 NOTREACHED(); |
306 } | 346 } |
307 | 347 |
308 if (Manifest::IsUnpackedLocation(item.location())) { | 348 if (Manifest::IsUnpackedLocation(item.location())) { |
309 info->path.reset( | 349 info->path.reset( |
310 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); | 350 new std::string(base::UTF16ToUTF8(item.path().LossyDisplayName()))); |
311 for (std::vector<extensions::InstallWarning>::const_iterator it = | 351 // If the ErrorConsole is enabled, get the errors for the extension and add |
312 item.install_warnings().begin(); | 352 // them to the list. Otherwise, use the install warnings (using both is |
313 it != item.install_warnings().end(); ++it) { | 353 // redundant). |
314 developer::InstallWarning* warning = new developer::InstallWarning(); | 354 ErrorConsole* error_console = ErrorConsole::Get(GetProfile()); |
315 warning->message = it->message; | 355 if (error_console->enabled()) { |
316 info->install_warnings.push_back(make_linked_ptr(warning)); | 356 const ErrorList& errors = error_console->GetErrorsForExtension(item.id()); |
357 if (!errors.empty()) { | |
358 for (ErrorList::const_iterator iter = errors.begin(); | |
359 iter != errors.end(); | |
360 ++iter) { | |
361 if ((*iter)->type() == ExtensionError::MANIFEST_ERROR) { | |
362 info->manifest_errors.push_back( | |
363 make_linked_ptr((*iter)->ToValue().release())); | |
364 } else { // runtime error | |
Finnur
2014/02/11 13:11:28
nit: End all regular comments with period.
More i
Devlin
2014/02/11 18:41:16
Done.
| |
365 const RuntimeError* error = static_cast<const RuntimeError*>(*iter); | |
366 scoped_ptr<base::DictionaryValue> value = error->ToValue(); | |
367 bool can_inspect = content::RenderViewHost::FromID( | |
368 error->render_process_id(), | |
369 error->render_view_id()) != NULL; | |
370 value->SetBoolean("canInspect", can_inspect); | |
371 info->runtime_errors.push_back(make_linked_ptr(value.release())); | |
372 } | |
373 } | |
374 } | |
375 } else { | |
376 for (std::vector<extensions::InstallWarning>::const_iterator it = | |
377 item.install_warnings().begin(); | |
378 it != item.install_warnings().end(); | |
379 ++it) { | |
380 developer::InstallWarning* warning = new developer::InstallWarning(); | |
381 warning->message = it->message; | |
382 info->install_warnings.push_back(make_linked_ptr(warning)); | |
383 } | |
317 } | 384 } |
318 } | 385 } |
319 | 386 |
320 info->incognito_enabled = util::IsIncognitoEnabled(item.id(), GetProfile()); | 387 info->incognito_enabled = util::IsIncognitoEnabled(item.id(), GetProfile()); |
321 info->wants_file_access = item.wants_file_access(); | 388 info->wants_file_access = item.wants_file_access(); |
322 info->allow_file_access = util::AllowFileAccess(item.id(), GetProfile()); | 389 info->allow_file_access = util::AllowFileAccess(item.id(), GetProfile()); |
323 info->allow_reload = Manifest::IsUnpackedLocation(item.location()); | 390 info->allow_reload = Manifest::IsUnpackedLocation(item.location()); |
324 info->is_unpacked = Manifest::IsUnpackedLocation(item.location()); | 391 info->is_unpacked = Manifest::IsUnpackedLocation(item.location()); |
325 info->terminated = registry->terminated_extensions().Contains(item.id()); | 392 info->terminated = registry->terminated_extensions().Contains(item.id()); |
326 info->allow_incognito = item.can_be_incognito_enabled(); | 393 info->allow_incognito = item.can_be_incognito_enabled(); |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1200 Release(); | 1267 Release(); |
1201 } | 1268 } |
1202 | 1269 |
1203 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { | 1270 void DeveloperPrivateChoosePathFunction::FileSelectionCanceled() { |
1204 SendResponse(false); | 1271 SendResponse(false); |
1205 Release(); | 1272 Release(); |
1206 } | 1273 } |
1207 | 1274 |
1208 DeveloperPrivateChoosePathFunction::~DeveloperPrivateChoosePathFunction() {} | 1275 DeveloperPrivateChoosePathFunction::~DeveloperPrivateChoosePathFunction() {} |
1209 | 1276 |
1210 bool DeveloperPrivateGetStringsFunction::RunImpl() { | |
1211 base::DictionaryValue* dict = new base::DictionaryValue(); | |
1212 SetResult(dict); | |
1213 | |
1214 webui::SetFontAndTextDirection(dict); | |
1215 | |
1216 #define SET_STRING(id, idr) \ | |
1217 dict->SetString(id, l10n_util::GetStringUTF16(idr)) | |
1218 SET_STRING("extensionSettings", IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE); | |
1219 | |
1220 SET_STRING("appsDevtoolSearch", IDS_APPS_DEVTOOL_SEARCH); | |
1221 SET_STRING("appsDevtoolApps", IDS_APPS_DEVTOOL_APPS_INSTALLED); | |
1222 SET_STRING("appsDevtoolExtensions", IDS_APPS_DEVTOOL_EXTENSIONS_INSTALLED); | |
1223 SET_STRING("appsDevtoolNoExtensions", IDS_EXTENSIONS_NONE_INSTALLED); | |
1224 SET_STRING("appsDevtoolUnpacked", IDS_APPS_DEVTOOL_UNPACKED_INSTALLED); | |
1225 SET_STRING("appsDevtoolInstalled", IDS_APPS_DEVTOOL_INSTALLED); | |
1226 SET_STRING("appsDevtoolNoPackedApps", IDS_APPS_DEVTOOL_NO_PACKED_APPS); | |
1227 SET_STRING("appsDevtoolNoUnpackedApps", IDS_APPS_DEVTOOL_NO_UNPACKED_APPS); | |
1228 SET_STRING("appsDevtoolNoPackedExtensions", | |
1229 IDS_APPS_DEVTOOL_NO_PACKED_EXTENSIONS); | |
1230 SET_STRING("appsDevtoolNoUnpackedExtensions", | |
1231 IDS_APPS_DEVTOOL_NO_UNPACKED_EXTENSIONS); | |
1232 SET_STRING("appsDevtoolUpdating", IDS_APPS_DEVTOOL_UPDATING); | |
1233 SET_STRING("extensionSettingsGetMoreExtensions", IDS_GET_MORE_EXTENSIONS); | |
1234 SET_STRING("extensionSettingsExtensionId", IDS_EXTENSIONS_ID); | |
1235 SET_STRING("extensionSettingsExtensionPath", IDS_EXTENSIONS_PATH); | |
1236 SET_STRING("extensionSettingsInspectViews", IDS_EXTENSIONS_INSPECT_VIEWS); | |
1237 SET_STRING("extensionSettingsInstallWarnings", | |
1238 IDS_EXTENSIONS_INSTALL_WARNINGS); | |
1239 SET_STRING("viewIncognito", IDS_EXTENSIONS_VIEW_INCOGNITO); | |
1240 SET_STRING("viewInactive", IDS_EXTENSIONS_VIEW_INACTIVE); | |
1241 SET_STRING("backgroundPage", IDS_EXTENSIONS_BACKGROUND_PAGE); | |
1242 SET_STRING("extensionSettingsEnable", IDS_EXTENSIONS_ENABLE); | |
1243 SET_STRING("extensionSettingsEnabled", IDS_EXTENSIONS_ENABLED); | |
1244 SET_STRING("extensionSettingsRemove", IDS_EXTENSIONS_REMOVE); | |
1245 SET_STRING("extensionSettingsEnableIncognito", | |
1246 IDS_EXTENSIONS_ENABLE_INCOGNITO); | |
1247 SET_STRING("extensionSettingsAllowFileAccess", | |
1248 IDS_EXTENSIONS_ALLOW_FILE_ACCESS); | |
1249 SET_STRING("extensionSettingsReloadTerminated", | |
1250 IDS_EXTENSIONS_RELOAD_TERMINATED); | |
1251 SET_STRING("extensionSettingsReloadUnpacked", | |
1252 IDS_APPS_DEV_TOOLS_RELOAD_UNPACKED); | |
1253 SET_STRING("extensionSettingsLaunch", IDS_EXTENSIONS_LAUNCH); | |
1254 SET_STRING("extensionSettingsOptions", IDS_EXTENSIONS_OPTIONS_LINK); | |
1255 SET_STRING("extensionSettingsPermissions", IDS_EXTENSIONS_PERMISSIONS_LINK); | |
1256 SET_STRING("extensionSettingsVisitWebsite", IDS_EXTENSIONS_VISIT_WEBSITE); | |
1257 SET_STRING("extensionSettingsVisitWebStore", IDS_EXTENSIONS_VISIT_WEBSTORE); | |
1258 SET_STRING("extensionSettingsPolicyControlled", | |
1259 IDS_EXTENSIONS_POLICY_CONTROLLED); | |
1260 SET_STRING("extensionSettingsManagedMode", | |
1261 IDS_EXTENSIONS_LOCKED_MANAGED_USER); | |
1262 SET_STRING("extensionSettingsShowButton", IDS_EXTENSIONS_SHOW_BUTTON); | |
1263 SET_STRING("appsDevtoolLoadUnpackedButton", | |
1264 IDS_APPS_DEVTOOL_LOAD_UNPACKED_BUTTON); | |
1265 SET_STRING("appsDevtoolPackButton", IDS_APPS_DEVTOOL_PACK_BUTTON); | |
1266 SET_STRING("extensionSettingsCommandsLink", | |
1267 IDS_EXTENSIONS_COMMANDS_CONFIGURE); | |
1268 SET_STRING("appsDevtoolUpdateButton", IDS_APPS_DEVTOOL_UPDATE_BUTTON); | |
1269 SET_STRING("extensionSettingsWarningsTitle", IDS_EXTENSION_WARNINGS_TITLE); | |
1270 SET_STRING("extensionSettingsShowDetails", IDS_EXTENSIONS_SHOW_DETAILS); | |
1271 SET_STRING("extensionSettingsHideDetails", IDS_EXTENSIONS_HIDE_DETAILS); | |
1272 SET_STRING("extensionUninstall", IDS_EXTENSIONS_UNINSTALL); | |
1273 SET_STRING("extensionsPermissionsHeading", | |
1274 IDS_EXTENSIONS_PERMISSIONS_HEADING); | |
1275 SET_STRING("extensionsPermissionsClose", IDS_EXTENSIONS_PERMISSIONS_CLOSE); | |
1276 SET_STRING("extensionDisabled", IDS_EXTENSIONS_DISABLED); | |
1277 SET_STRING("extensionSettingsShowLogsButton", IDS_EXTENSIONS_SHOW_LOGS); | |
1278 SET_STRING("extensionSettingsMoreDetailsButton", IDS_EXTENSIONS_MORE_DETAILS); | |
1279 SET_STRING("extensionSettingsVersion", IDS_EXTENSIONS_VERSION); | |
1280 SET_STRING("extensionSettingsDelete", IDS_EXTENSIONS_ADT_DELETE); | |
1281 SET_STRING("extensionSettingsPack", IDS_EXTENSIONS_PACK); | |
1282 | |
1283 // Pack Extension strings | |
1284 SET_STRING("packExtensionOverlay", IDS_EXTENSION_PACK_DIALOG_TITLE); | |
1285 SET_STRING("packExtensionHeading", IDS_EXTENSION_ADT_PACK_DIALOG_HEADING); | |
1286 SET_STRING("packButton", IDS_EXTENSION_ADT_PACK_BUTTON); | |
1287 SET_STRING("ok", IDS_OK); | |
1288 SET_STRING("cancel", IDS_CANCEL); | |
1289 SET_STRING("packExtensionRootDir", | |
1290 IDS_EXTENSION_PACK_DIALOG_ROOT_DIRECTORY_LABEL); | |
1291 SET_STRING("packExtensionPrivateKey", | |
1292 IDS_EXTENSION_PACK_DIALOG_PRIVATE_KEY_LABEL); | |
1293 SET_STRING("packExtensionBrowseButton", IDS_EXTENSION_PACK_DIALOG_BROWSE); | |
1294 SET_STRING("packExtensionProceedAnyway", IDS_EXTENSION_PROCEED_ANYWAY); | |
1295 SET_STRING("packExtensionWarningTitle", IDS_EXTENSION_PACK_WARNING_TITLE); | |
1296 SET_STRING("packExtensionErrorTitle", IDS_EXTENSION_PACK_ERROR_TITLE); | |
1297 SET_STRING("packAppOverlay", IDS_EXTENSION_PACK_APP_DIALOG_TITLE); | |
1298 SET_STRING("packAppHeading", IDS_EXTENSION_ADT_PACK_APP_DIALOG_HEADING); | |
1299 | |
1300 // Delete confirmation dialog. | |
1301 SET_STRING("deleteConfirmationDeleteButton", | |
1302 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_BUTTON); | |
1303 SET_STRING("deleteConfirmationTitle", | |
1304 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_TITLE); | |
1305 SET_STRING("deleteConfirmationMessageApp", | |
1306 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_APP); | |
1307 SET_STRING("deleteConfirmationMessageExtension", | |
1308 IDS_APPS_DEVTOOL_DELETE_CONFIRMATION_MESSAGE_EXTENSION); | |
1309 | |
1310 // Dialog when profile is managed. | |
1311 SET_STRING("managedProfileDialogCloseButton", | |
1312 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_CLOSE_BUTTON); | |
1313 SET_STRING("managedProfileDialogTitle", | |
1314 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_TITLE); | |
1315 SET_STRING("managedProfileDialogDescription", | |
1316 IDS_APPS_DEVTOOL_MANAGED_PROFILE_DIALOG_DESCRIPTION); | |
1317 | |
1318 #undef SET_STRING | |
1319 return true; | |
1320 } | |
1321 | |
1322 DeveloperPrivateGetStringsFunction::~DeveloperPrivateGetStringsFunction() {} | |
1323 | |
1324 bool DeveloperPrivateIsProfileManagedFunction::RunImpl() { | 1277 bool DeveloperPrivateIsProfileManagedFunction::RunImpl() { |
1325 SetResult(new base::FundamentalValue(GetProfile()->IsManaged())); | 1278 SetResult(new base::FundamentalValue(GetProfile()->IsManaged())); |
1326 return true; | 1279 return true; |
1327 } | 1280 } |
1328 | 1281 |
1329 DeveloperPrivateIsProfileManagedFunction:: | 1282 DeveloperPrivateIsProfileManagedFunction:: |
1330 ~DeveloperPrivateIsProfileManagedFunction() { | 1283 ~DeveloperPrivateIsProfileManagedFunction() { |
1331 } | 1284 } |
1332 | 1285 |
1286 DeveloperPrivateRequestFileSourceFunction:: | |
1287 DeveloperPrivateRequestFileSourceFunction() {} | |
1288 | |
1289 DeveloperPrivateRequestFileSourceFunction:: | |
1290 ~DeveloperPrivateRequestFileSourceFunction() {} | |
1291 | |
1292 bool DeveloperPrivateRequestFileSourceFunction::RunImpl() { | |
1293 scoped_ptr<developer::RequestFileSource::Params> params( | |
1294 developer::RequestFileSource::Params::Create(*args_)); | |
1295 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); | |
1296 | |
1297 base::DictionaryValue* dict = NULL; | |
1298 if (!params->dict->GetAsDictionary(&dict)) { | |
1299 NOTREACHED(); | |
1300 return false; | |
1301 } | |
1302 | |
1303 AddRef(); // Balanced in LaunchCallback(). | |
1304 error_ui_util::HandleRequestFileSource( | |
1305 dict, | |
1306 GetProfile(), | |
1307 base::Bind(&DeveloperPrivateRequestFileSourceFunction::LaunchCallback, | |
1308 base::Unretained(this))); | |
1309 return true; | |
1310 } | |
1311 | |
1312 void DeveloperPrivateRequestFileSourceFunction::LaunchCallback( | |
1313 const base::DictionaryValue& results) { | |
1314 SetResult(results.DeepCopy()); | |
1315 SendResponse(true); | |
1316 Release(); // Balanced in RunImpl(). | |
1317 } | |
1318 | |
1319 DeveloperPrivateOpenDevToolsFunction::DeveloperPrivateOpenDevToolsFunction() {} | |
1320 DeveloperPrivateOpenDevToolsFunction::~DeveloperPrivateOpenDevToolsFunction() {} | |
1321 | |
1322 bool DeveloperPrivateOpenDevToolsFunction::RunImpl() { | |
1323 scoped_ptr<developer::OpenDevTools::Params> params( | |
1324 developer::OpenDevTools::Params::Create(*args_)); | |
1325 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); | |
1326 | |
1327 base::DictionaryValue* dict = NULL; | |
1328 if (!params->dict->GetAsDictionary(&dict)) { | |
1329 NOTREACHED(); | |
1330 return false; | |
1331 } | |
1332 | |
1333 error_ui_util::HandleOpenDevTools(dict); | |
1334 | |
1335 return true; | |
1336 } | |
1337 | |
1333 } // namespace api | 1338 } // namespace api |
1334 | 1339 |
1335 } // namespace extensions | 1340 } // namespace extensions |
OLD | NEW |