| 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/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_url_handler.h" | 10 #include "chrome/browser/browser_url_handler.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Find a compatible window and re-execute this command in it. Otherwise | 179 // Find a compatible window and re-execute this command in it. Otherwise |
| 180 // re-run with NEW_WINDOW. | 180 // re-run with NEW_WINDOW. |
| 181 if (profile) | 181 if (profile) |
| 182 return GetOrCreateBrowser(profile); | 182 return GetOrCreateBrowser(profile); |
| 183 return NULL; | 183 return NULL; |
| 184 case NEW_POPUP: { | 184 case NEW_POPUP: { |
| 185 // Make a new popup window. | 185 // Make a new popup window. |
| 186 if (profile) { | 186 if (profile) { |
| 187 // Coerce app-style if |params->browser| or |source| represents an app. | 187 // Coerce app-style if |params->browser| or |source| represents an app. |
| 188 std::string app_name; | 188 std::string app_name; |
| 189 if (params->browser && !params->browser->app_name().empty()) { | 189 if (!params->extension_app_id.empty()) { |
| 190 app_name = params->extension_app_id; |
| 191 } else if (params->browser && !params->browser->app_name().empty()) { |
| 190 app_name = params->browser->app_name(); | 192 app_name = params->browser->app_name(); |
| 191 } else if (params->source_contents && | 193 } else if (params->source_contents && |
| 192 params->source_contents->extension_tab_helper()->is_app()) { | 194 params->source_contents->extension_tab_helper()->is_app()) { |
| 193 app_name = params->source_contents->extension_tab_helper()-> | 195 app_name = params->source_contents->extension_tab_helper()-> |
| 194 extension_app()->id(); | 196 extension_app()->id(); |
| 195 } | 197 } |
| 196 if (app_name.empty()) { | 198 if (app_name.empty()) { |
| 197 Browser::CreateParams browser_params(Browser::TYPE_POPUP, profile); | 199 Browser::CreateParams browser_params(Browser::TYPE_POPUP, profile); |
| 198 browser_params.initial_bounds = params->window_bounds; | 200 browser_params.initial_bounds = params->window_bounds; |
| 199 return Browser::CreateWithParams(browser_params); | 201 return Browser::CreateWithParams(browser_params); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 params->url, params->referrer, params->transition); | 523 params->url, params->referrer, params->transition); |
| 522 } | 524 } |
| 523 | 525 |
| 524 // If the singleton tab isn't already selected, select it. | 526 // If the singleton tab isn't already selected, select it. |
| 525 if (params->source_contents != params->target_contents) | 527 if (params->source_contents != params->target_contents) |
| 526 params->browser->ActivateTabAt(singleton_index, user_initiated); | 528 params->browser->ActivateTabAt(singleton_index, user_initiated); |
| 527 } | 529 } |
| 528 } | 530 } |
| 529 | 531 |
| 530 } // namespace browser | 532 } // namespace browser |
| OLD | NEW |