| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 extension_id); | 349 extension_id); |
| 350 return false; | 350 return false; |
| 351 } | 351 } |
| 352 | 352 |
| 353 // Look at prefs to find the right launch container. | 353 // Look at prefs to find the right launch container. |
| 354 // |default_pref_value| is set to LAUNCH_REGULAR so that if | 354 // |default_pref_value| is set to LAUNCH_REGULAR so that if |
| 355 // the user has not set a preference, we open the app in a tab. | 355 // the user has not set a preference, we open the app in a tab. |
| 356 extension_misc::LaunchContainer launch_container = | 356 extension_misc::LaunchContainer launch_container = |
| 357 service()->extension_prefs()->GetLaunchContainer( | 357 service()->extension_prefs()->GetLaunchContainer( |
| 358 extension, ExtensionPrefs::LAUNCH_DEFAULT); | 358 extension, ExtensionPrefs::LAUNCH_DEFAULT); |
| 359 Browser::OpenApplication(profile(), extension, launch_container, | 359 Browser::OpenApplication(profile(), extension, launch_container, GURL(), |
| 360 NEW_FOREGROUND_TAB); | 360 NEW_FOREGROUND_TAB); |
| 361 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 361 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 362 extension_misc::APP_LAUNCH_EXTENSION_API, | 362 extension_misc::APP_LAUNCH_EXTENSION_API, |
| 363 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 363 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 364 | 364 |
| 365 return true; | 365 return true; |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool SetEnabledFunction::RunImpl() { | 368 bool SetEnabledFunction::RunImpl() { |
| 369 std::string extension_id; | 369 std::string extension_id; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; | 480 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; |
| 481 args.Append(CreateExtensionInfo(*extension, enabled)); | 481 args.Append(CreateExtensionInfo(*extension, enabled)); |
| 482 } | 482 } |
| 483 | 483 |
| 484 std::string args_json; | 484 std::string args_json; |
| 485 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); | 485 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); |
| 486 | 486 |
| 487 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 487 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 488 event_name, args_json, NULL, GURL()); | 488 event_name, args_json, NULL, GURL()); |
| 489 } | 489 } |
| OLD | NEW |