| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/app_launcher_handler.h" | 5 #include "chrome/browser/dom_ui/app_launcher_handler.h" |
| 6 | 6 |
| 7 #include "app/animation.h" | |
| 8 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 9 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 10 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 11 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 12 #include "base/values.h" |
| 14 #include "chrome/browser/app_launched_animation.h" | 13 #include "chrome/browser/app_launched_animation.h" |
| 15 #include "chrome/browser/extensions/default_apps.h" | 14 #include "chrome/browser/extensions/default_apps.h" |
| 16 #include "chrome/browser/extensions/extension_prefs.h" | 15 #include "chrome/browser/extensions/extension_prefs.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/platform_util.h" | 17 #include "chrome/browser/platform_util.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
| 21 #include "chrome/browser/ui/browser.h" | 20 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_list.h" | 21 #include "chrome/browser/ui/browser_list.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
| 26 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 27 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
| 28 #include "chrome/common/extensions/extension_resource.h" | 27 #include "chrome/common/extensions/extension_resource.h" |
| 29 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 30 #include "chrome/common/notification_type.h" | 29 #include "chrome/common/notification_type.h" |
| 31 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 32 #include "gfx/rect.h" | 31 #include "gfx/rect.h" |
| 33 #include "grit/browser_resources.h" | 32 #include "grit/browser_resources.h" |
| 34 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
| 34 #include "ui/base/animation/animation.h" |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 // The URL prefixes used by the NTP to signal when the web store or an app | 38 // The URL prefixes used by the NTP to signal when the web store or an app |
| 39 // has launched. These are used for histogram purposes. | 39 // has launched. These are used for histogram purposes. |
| 40 const char* kLaunchAppPingURL = "record-app-launch"; | 40 const char* kLaunchAppPingURL = "record-app-launch"; |
| 41 const char* kLaunchWebStorePingURL = "record-webstore-launch"; | 41 const char* kLaunchWebStorePingURL = "record-webstore-launch"; |
| 42 | 42 |
| 43 // This extracts an int from a ListValue at the given |index|. | 43 // This extracts an int from a ListValue at the given |index|. |
| 44 bool ExtractInt(const ListValue* list, size_t index, int* out_int) { | 44 bool ExtractInt(const ListValue* list, size_t index, int* out_int) { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { | 403 ExtensionInstallUI* AppLauncherHandler::GetExtensionInstallUI() { |
| 404 if (!install_ui_.get()) | 404 if (!install_ui_.get()) |
| 405 install_ui_.reset(new ExtensionInstallUI(dom_ui_->GetProfile())); | 405 install_ui_.reset(new ExtensionInstallUI(dom_ui_->GetProfile())); |
| 406 return install_ui_.get(); | 406 return install_ui_.get(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void AppLauncherHandler::AnimateAppIcon(const Extension* extension, | 409 void AppLauncherHandler::AnimateAppIcon(const Extension* extension, |
| 410 const gfx::Rect& rect) { | 410 const gfx::Rect& rect) { |
| 411 // We make this check for the case of minimized windows, unit tests, etc. | 411 // We make this check for the case of minimized windows, unit tests, etc. |
| 412 if (platform_util::IsVisible(dom_ui_->tab_contents()->GetNativeView()) && | 412 if (platform_util::IsVisible(dom_ui_->tab_contents()->GetNativeView()) && |
| 413 Animation::ShouldRenderRichAnimation()) { | 413 ui::Animation::ShouldRenderRichAnimation()) { |
| 414 #if defined(OS_WIN) | 414 #if defined(OS_WIN) |
| 415 AppLaunchedAnimation::Show(extension, rect); | 415 AppLaunchedAnimation::Show(extension, rect); |
| 416 #else | 416 #else |
| 417 NOTIMPLEMENTED(); | 417 NOTIMPLEMENTED(); |
| 418 #endif | 418 #endif |
| 419 } | 419 } |
| 420 } | 420 } |
| OLD | NEW |