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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 7249013: Extension ID should be converted to app name when it is passed to the Browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ui/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_about_handler.h" 10 #include "chrome/browser/browser_about_handler.h"
11 #include "chrome/browser/browser_url_handler.h" 11 #include "chrome/browser/browser_url_handler.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_tab_helper.h" 13 #include "chrome/browser/extensions/extension_tab_helper.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/tabs/tab_strip_model.h" 15 #include "chrome/browser/tabs/tab_strip_model.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/browser/ui/browser_window.h" 18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/omnibox/location_bar.h" 19 #include "chrome/browser/ui/omnibox/location_bar.h"
20 #include "chrome/browser/ui/status_bubble.h" 20 #include "chrome/browser/ui/status_bubble.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
22 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h" 22 #include "chrome/browser/ui/webui/chrome_web_ui_factory.h"
23 #include "chrome/browser/web_applications/web_app.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
25 #include "chrome/common/url_constants.h" 26 #include "chrome/common/url_constants.h"
26 #include "content/browser/site_instance.h" 27 #include "content/browser/site_instance.h"
27 #include "content/browser/tab_contents/tab_contents.h" 28 #include "content/browser/tab_contents/tab_contents.h"
28 29
29 namespace { 30 namespace {
30 31
31 // Returns an appropriate SiteInstance for WebUI URLs, or the SiteInstance for 32 // Returns an appropriate SiteInstance for WebUI URLs, or the SiteInstance for
32 // |source_contents| if it represents the same website as |url|. Returns NULL 33 // |source_contents| if it represents the same website as |url|. Returns NULL
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // re-run with NEW_WINDOW. 138 // re-run with NEW_WINDOW.
138 if (profile) 139 if (profile)
139 return GetOrCreateBrowser(profile); 140 return GetOrCreateBrowser(profile);
140 return NULL; 141 return NULL;
141 case NEW_POPUP: { 142 case NEW_POPUP: {
142 // Make a new popup window. 143 // Make a new popup window.
143 if (profile) { 144 if (profile) {
144 // Coerce app-style if |params->browser| or |source| represents an app. 145 // Coerce app-style if |params->browser| or |source| represents an app.
145 std::string app_name; 146 std::string app_name;
146 if (!params->extension_app_id.empty()) { 147 if (!params->extension_app_id.empty()) {
147 app_name = params->extension_app_id; 148 app_name = web_app::GenerateApplicationNameFromExtensionId(
149 params->extension_app_id);
148 } else if (params->browser && !params->browser->app_name().empty()) { 150 } else if (params->browser && !params->browser->app_name().empty()) {
149 app_name = params->browser->app_name(); 151 app_name = params->browser->app_name();
150 } else if (params->source_contents && 152 } else if (params->source_contents &&
151 params->source_contents->extension_tab_helper()->is_app()) { 153 params->source_contents->extension_tab_helper()->is_app()) {
152 app_name = params->source_contents->extension_tab_helper()-> 154 app_name = web_app::GenerateApplicationNameFromExtensionId(
153 extension_app()->id(); 155 params->source_contents->extension_tab_helper()->
156 extension_app()->id());
154 } 157 }
155 if (app_name.empty()) { 158 if (app_name.empty()) {
156 Browser::CreateParams browser_params(Browser::TYPE_POPUP, profile); 159 Browser::CreateParams browser_params(Browser::TYPE_POPUP, profile);
157 browser_params.initial_bounds = params->window_bounds; 160 browser_params.initial_bounds = params->window_bounds;
158 return Browser::CreateWithParams(browser_params); 161 return Browser::CreateWithParams(browser_params);
159 } else { 162 } else {
160 return Browser::CreateForApp(Browser::TYPE_POPUP, app_name, 163 return Browser::CreateForApp(Browser::TYPE_POPUP, app_name,
161 params->window_bounds, profile); 164 params->window_bounds, profile);
162 } 165 }
163 } 166 }
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 rewritten_url, replacements)) { 531 rewritten_url, replacements)) {
529 params->target_contents = tab; 532 params->target_contents = tab;
530 return tab_index; 533 return tab_index;
531 } 534 }
532 } 535 }
533 536
534 return -1; 537 return -1;
535 } 538 }
536 539
537 } // namespace browser 540 } // namespace browser
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698