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/ui/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
Lei Zhang
2012/09/28 18:41:24
You can remove this #include too.
Nico
2012/09/29 11:08:40
Done.
| |
17 #include "base/string_split.h" | 17 #include "base/string_split.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "base/values.h" | 20 #include "base/values.h" |
21 #include "chrome/browser/extensions/app_notification.h" | 21 #include "chrome/browser/extensions/app_notification.h" |
22 #include "chrome/browser/extensions/app_notification_manager.h" | 22 #include "chrome/browser/extensions/app_notification_manager.h" |
23 #include "chrome/browser/extensions/crx_installer.h" | 23 #include "chrome/browser/extensions/crx_installer.h" |
24 #include "chrome/browser/extensions/extension_prefs.h" | 24 #include "chrome/browser/extensions/extension_prefs.h" |
25 #include "chrome/browser/extensions/extension_service.h" | 25 #include "chrome/browser/extensions/extension_service.h" |
26 #include "chrome/browser/extensions/extension_sorting.h" | 26 #include "chrome/browser/extensions/extension_sorting.h" |
(...skipping 29 matching lines...) Expand all Loading... | |
56 #include "ui/gfx/codec/png_codec.h" | 56 #include "ui/gfx/codec/png_codec.h" |
57 #include "ui/gfx/favicon_size.h" | 57 #include "ui/gfx/favicon_size.h" |
58 | 58 |
59 using application_launch::LaunchParams; | 59 using application_launch::LaunchParams; |
60 using application_launch::OpenApplication; | 60 using application_launch::OpenApplication; |
61 using content::WebContents; | 61 using content::WebContents; |
62 using extensions::CrxInstaller; | 62 using extensions::CrxInstaller; |
63 using extensions::Extension; | 63 using extensions::Extension; |
64 using extensions::ExtensionPrefs; | 64 using extensions::ExtensionPrefs; |
65 | 65 |
66 namespace { | |
67 | |
68 const net::UnescapeRule::Type kUnescapeRules = | 66 const net::UnescapeRule::Type kUnescapeRules = |
69 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS; | 67 net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS; |
70 | 68 |
71 extension_misc::AppLaunchBucket ParseLaunchSource( | |
72 const std::string& launch_source) { | |
73 int bucket_num = extension_misc::APP_LAUNCH_BUCKET_INVALID; | |
74 base::StringToInt(launch_source, &bucket_num); | |
75 extension_misc::AppLaunchBucket bucket = | |
76 static_cast<extension_misc::AppLaunchBucket>(bucket_num); | |
77 CHECK(bucket < extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | |
78 return bucket; | |
79 } | |
80 | |
81 } // namespace | |
82 | |
83 AppLauncherHandler::AppInstallInfo::AppInstallInfo() {} | 69 AppLauncherHandler::AppInstallInfo::AppInstallInfo() {} |
84 | 70 |
85 AppLauncherHandler::AppInstallInfo::~AppInstallInfo() {} | 71 AppLauncherHandler::AppInstallInfo::~AppInstallInfo() {} |
86 | 72 |
87 AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service) | 73 AppLauncherHandler::AppLauncherHandler(ExtensionService* extension_service) |
88 : extension_service_(extension_service), | 74 : extension_service_(extension_service), |
89 ignore_changes_(false), | 75 ignore_changes_(false), |
90 attempted_bookmark_app_install_(false), | 76 attempted_bookmark_app_install_(false), |
91 has_loaded_apps_(false) { | 77 has_loaded_apps_(false) { |
92 } | 78 } |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
941 | 927 |
942 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() { | 928 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() { |
943 if (!extension_install_ui_.get()) { | 929 if (!extension_install_ui_.get()) { |
944 Browser* browser = browser::FindBrowserWithWebContents( | 930 Browser* browser = browser::FindBrowserWithWebContents( |
945 web_ui()->GetWebContents()); | 931 web_ui()->GetWebContents()); |
946 extension_install_ui_.reset( | 932 extension_install_ui_.reset( |
947 chrome::CreateExtensionInstallPromptWithBrowser(browser)); | 933 chrome::CreateExtensionInstallPromptWithBrowser(browser)); |
948 } | 934 } |
949 return extension_install_ui_.get(); | 935 return extension_install_ui_.get(); |
950 } | 936 } |
OLD | NEW |