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/browser.h" |
22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
23 #if !defined(OS_ANDROID) | |
Jesse Greenwald
2012/04/10 23:59:47
Move to the end of the include list
| |
23 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 24 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
25 #endif | |
24 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/chrome_utility_messages.h" | 27 #include "chrome/common/chrome_utility_messages.h" |
26 #include "chrome/common/extensions/extension.h" | 28 #include "chrome/common/extensions/extension.h" |
27 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
28 #include "chrome/common/extensions/extension_error_utils.h" | 30 #include "chrome/common/extensions/extension_error_utils.h" |
29 #include "chrome/common/extensions/extension_icon_set.h" | 31 #include "chrome/common/extensions/extension_icon_set.h" |
30 #include "chrome/common/extensions/url_pattern.h" | 32 #include "chrome/common/extensions/url_pattern.h" |
31 #include "content/public/browser/notification_details.h" | 33 #include "content/public/browser/notification_details.h" |
32 #include "content/public/browser/notification_source.h" | 34 #include "content/public/browser/notification_source.h" |
33 #include "content/public/browser/utility_process_host.h" | 35 #include "content/public/browser/utility_process_host.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 } | 333 } |
332 | 334 |
333 // Look at prefs to find the right launch container. | 335 // Look at prefs to find the right launch container. |
334 // |default_pref_value| is set to LAUNCH_REGULAR so that if | 336 // |default_pref_value| is set to LAUNCH_REGULAR so that if |
335 // the user has not set a preference, we open the app in a tab. | 337 // the user has not set a preference, we open the app in a tab. |
336 extension_misc::LaunchContainer launch_container = | 338 extension_misc::LaunchContainer launch_container = |
337 service()->extension_prefs()->GetLaunchContainer( | 339 service()->extension_prefs()->GetLaunchContainer( |
338 extension, ExtensionPrefs::LAUNCH_DEFAULT); | 340 extension, ExtensionPrefs::LAUNCH_DEFAULT); |
339 Browser::OpenApplication(profile(), extension, launch_container, GURL(), | 341 Browser::OpenApplication(profile(), extension, launch_container, GURL(), |
340 NEW_FOREGROUND_TAB); | 342 NEW_FOREGROUND_TAB); |
343 #if !defined(OS_ANDROID) | |
341 AppLauncherHandler::RecordAppLaunchType( | 344 AppLauncherHandler::RecordAppLaunchType( |
342 extension_misc::APP_LAUNCH_EXTENSION_API); | 345 extension_misc::APP_LAUNCH_EXTENSION_API); |
346 #endif | |
343 | 347 |
344 return true; | 348 return true; |
345 } | 349 } |
346 | 350 |
347 SetEnabledFunction::SetEnabledFunction() {} | 351 SetEnabledFunction::SetEnabledFunction() {} |
348 | 352 |
349 SetEnabledFunction::~SetEnabledFunction() {} | 353 SetEnabledFunction::~SetEnabledFunction() {} |
350 | 354 |
351 bool SetEnabledFunction::RunImpl() { | 355 bool SetEnabledFunction::RunImpl() { |
352 bool enable; | 356 bool enable; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 ExtensionService* service = profile->GetExtensionService(); | 496 ExtensionService* service = profile->GetExtensionService(); |
493 args.Append(CreateExtensionInfo(*extension, service)); | 497 args.Append(CreateExtensionInfo(*extension, service)); |
494 } | 498 } |
495 | 499 |
496 std::string args_json; | 500 std::string args_json; |
497 base::JSONWriter::Write(&args, &args_json); | 501 base::JSONWriter::Write(&args, &args_json); |
498 | 502 |
499 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 503 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
500 event_name, args_json, NULL, GURL()); | 504 event_name, args_json, NULL, GURL()); |
501 } | 505 } |
OLD | NEW |