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/extension_management_api.h" | 5 #include "chrome/browser/extensions/extension_management_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "chrome/browser/extensions/extension_event_names.h" | 16 #include "chrome/browser/extensions/extension_event_names.h" |
17 #include "chrome/browser/extensions/extension_event_router.h" | 17 #include "chrome/browser/extensions/extension_event_router.h" |
18 #include "chrome/browser/extensions/extension_management_api_constants.h" | 18 #include "chrome/browser/extensions/extension_management_api_constants.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/extensions/application_launch.h" |
22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
23 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/chrome_utility_messages.h" | 24 #include "chrome/common/chrome_utility_messages.h" |
25 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
27 #include "chrome/common/extensions/extension_error_utils.h" | 27 #include "chrome/common/extensions/extension_error_utils.h" |
28 #include "chrome/common/extensions/extension_icon_set.h" | 28 #include "chrome/common/extensions/extension_icon_set.h" |
29 #include "chrome/common/extensions/url_pattern.h" | 29 #include "chrome/common/extensions/url_pattern.h" |
30 #include "content/public/browser/notification_details.h" | 30 #include "content/public/browser/notification_details.h" |
31 #include "content/public/browser/notification_source.h" | 31 #include "content/public/browser/notification_source.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 extension_id); | 333 extension_id); |
334 return false; | 334 return false; |
335 } | 335 } |
336 | 336 |
337 // Look at prefs to find the right launch container. | 337 // Look at prefs to find the right launch container. |
338 // |default_pref_value| is set to LAUNCH_REGULAR so that if | 338 // |default_pref_value| is set to LAUNCH_REGULAR so that if |
339 // the user has not set a preference, we open the app in a tab. | 339 // the user has not set a preference, we open the app in a tab. |
340 extension_misc::LaunchContainer launch_container = | 340 extension_misc::LaunchContainer launch_container = |
341 service()->extension_prefs()->GetLaunchContainer( | 341 service()->extension_prefs()->GetLaunchContainer( |
342 extension, ExtensionPrefs::LAUNCH_DEFAULT); | 342 extension, ExtensionPrefs::LAUNCH_DEFAULT); |
343 Browser::OpenApplication(profile(), extension, launch_container, GURL(), | 343 application_launch::OpenApplication(profile(), extension, launch_container, |
344 NEW_FOREGROUND_TAB); | 344 GURL(), NEW_FOREGROUND_TAB); |
345 #if !defined(OS_ANDROID) | 345 #if !defined(OS_ANDROID) |
346 AppLauncherHandler::RecordAppLaunchType( | 346 AppLauncherHandler::RecordAppLaunchType( |
347 extension_misc::APP_LAUNCH_EXTENSION_API); | 347 extension_misc::APP_LAUNCH_EXTENSION_API); |
348 #endif | 348 #endif |
349 | 349 |
350 return true; | 350 return true; |
351 } | 351 } |
352 | 352 |
353 SetEnabledFunction::SetEnabledFunction() {} | 353 SetEnabledFunction::SetEnabledFunction() {} |
354 | 354 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 ExtensionService* service = profile->GetExtensionService(); | 499 ExtensionService* service = profile->GetExtensionService(); |
500 args.Append(CreateExtensionInfo(*extension, service)); | 500 args.Append(CreateExtensionInfo(*extension, service)); |
501 } | 501 } |
502 | 502 |
503 std::string args_json; | 503 std::string args_json; |
504 base::JSONWriter::Write(&args, &args_json); | 504 base::JSONWriter::Write(&args, &args_json); |
505 | 505 |
506 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 506 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
507 event_name, args_json, NULL, GURL()); | 507 event_name, args_json, NULL, GURL()); |
508 } | 508 } |
OLD | NEW |