Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: chrome/browser/extensions/extension_install_ui.cc

Issue 7068007: Revise about: and chrome: url handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/stringprintf.h" 13 #include "base/stringprintf.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/browser/extensions/extension_install_dialog.h" 15 #include "chrome/browser/extensions/extension_install_dialog.h"
16 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 16 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
17 #include "chrome/browser/platform_util.h" 17 #include "chrome/browser/platform_util.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/tabs/tab_strip_model.h" 19 #include "chrome/browser/tabs/tab_strip_model.h"
20 #include "chrome/browser/themes/theme_service.h" 20 #include "chrome/browser/themes/theme_service.h"
21 #include "chrome/browser/themes/theme_service_factory.h" 21 #include "chrome/browser/themes/theme_service_factory.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_dialogs.h" 23 #include "chrome/browser/ui/browser_dialogs.h"
24 #include "chrome/browser/ui/browser_list.h" 24 #include "chrome/browser/ui/browser_list.h"
25 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 26 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
27 #include "chrome/browser/ui/webui/web_ui_util.h"
28 #include "chrome/common/extensions/extension.h" 27 #include "chrome/common/extensions/extension.h"
29 #include "chrome/common/extensions/extension_icon_set.h" 28 #include "chrome/common/extensions/extension_icon_set.h"
30 #include "chrome/common/extensions/extension_resource.h" 29 #include "chrome/common/extensions/extension_resource.h"
31 #include "chrome/common/extensions/url_pattern.h" 30 #include "chrome/common/extensions/url_pattern.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "content/common/notification_service.h" 32 #include "content/common/notification_service.h"
34 #include "grit/chromium_strings.h" 33 #include "grit/chromium_strings.h"
35 #include "grit/generated_resources.h" 34 #include "grit/generated_resources.h"
36 #include "grit/theme_resources.h" 35 #include "grit/theme_resources.h"
37 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
(...skipping 26 matching lines...) Expand all
64 63
65 // 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
66 // 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
67 // 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
68 // a new NTP. 67 // a new NTP.
69 void ShowAppInstalledAnimation(Browser* browser, const std::string& app_id) { 68 void ShowAppInstalledAnimation(Browser* browser, const std::string& app_id) {
70 // 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
71 // automatically show the install animation for any new apps. 70 // automatically show the install animation for any new apps.
72 for (int i = 0; i < browser->tab_count(); ++i) { 71 for (int i = 0; i < browser->tab_count(); ++i) {
73 GURL url = browser->GetTabContentsAt(i)->GetURL(); 72 GURL url = browser->GetTabContentsAt(i)->GetURL();
74 if (web_ui_util::ChromeURLHostEquals(url, chrome::kChromeUINewTabHost)) { 73 if (url.SchemeIs(chrome::kChromeUIScheme) &&
74 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 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/all_urls_apitest.cc ('k') | chrome/browser/extensions/extension_tabs_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698