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_install_ui.h" | 5 #include "chrome/browser/extensions/extension_install_ui.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const int kIconSize = 69; | 62 const int kIconSize = 69; |
63 | 63 |
64 // Shows the application install animation on the new tab page for the app | 64 // Shows the application install animation on the new tab page for the app |
65 // with |app_id|. If a NTP already exists on the active |browser|, this will | 65 // with |app_id|. If a NTP already exists on the active |browser|, this will |
66 // select that tab and show the animation there. Otherwise, it will create | 66 // select that tab and show the animation there. Otherwise, it will create |
67 // a new NTP. | 67 // a new NTP. |
68 void ShowAppInstalledAnimation(Browser* browser, const std::string& app_id) { | 68 void ShowAppInstalledAnimation(Browser* browser, const std::string& app_id) { |
69 // Select an already open NTP, if there is one. Existing NTPs will | 69 // Select an already open NTP, if there is one. Existing NTPs will |
70 // automatically show the install animation for any new apps. | 70 // automatically show the install animation for any new apps. |
71 for (int i = 0; i < browser->tab_count(); ++i) { | 71 for (int i = 0; i < browser->tab_count(); ++i) { |
72 TabContents* tab_contents = browser->GetTabContentsAt(i); | 72 GURL url = browser->GetTabContentsAt(i)->GetURL(); |
73 GURL url = tab_contents->GetURL(); | 73 if (url.SchemeIs(chrome::kChromeUIScheme) && |
74 if (StartsWithASCII(url.spec(), chrome::kChromeUINewTabURL, false)) { | 74 LowerCaseEqualsASCII(url.host(), chrome::kChromeUINewTabHost)) { |
75 browser->ActivateTabAt(i, false); | 75 browser->ActivateTabAt(i, false); |
76 return; | 76 return; |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 // If there isn't an NTP, open one and pass it the ID of the installed app. | 80 // If there isn't an NTP, open one and pass it the ID of the installed app. |
81 std::string url = base::StringPrintf( | 81 std::string url = base::StringPrintf( |
82 "%s/#app-id=%s", chrome::kChromeUINewTabURL, app_id.c_str()); | 82 "%s#app-id=%s", chrome::kChromeUINewTabURL, app_id.c_str()); |
83 browser->AddSelectedTabWithURL(GURL(url), PageTransition::TYPED); | 83 browser->AddSelectedTabWithURL(GURL(url), PageTransition::TYPED); |
84 } | 84 } |
85 | 85 |
86 } // namespace | 86 } // namespace |
87 | 87 |
88 ExtensionInstallUI::ExtensionInstallUI(Profile* profile) | 88 ExtensionInstallUI::ExtensionInstallUI(Profile* profile) |
89 : profile_(profile), | 89 : profile_(profile), |
90 ui_loop_(MessageLoop::current()), | 90 ui_loop_(MessageLoop::current()), |
91 previous_using_native_theme_(false), | 91 previous_using_native_theme_(false), |
92 extension_(NULL), | 92 extension_(NULL), |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( | 276 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( |
277 TabContents* tab_contents, | 277 TabContents* tab_contents, |
278 const Extension* new_theme, | 278 const Extension* new_theme, |
279 const std::string& previous_theme_id, | 279 const std::string& previous_theme_id, |
280 bool previous_using_native_theme) { | 280 bool previous_using_native_theme) { |
281 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, | 281 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, |
282 previous_theme_id, | 282 previous_theme_id, |
283 previous_using_native_theme); | 283 previous_using_native_theme); |
284 } | 284 } |
OLD | NEW |