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/extensions/application_launch.h" | 5 #include "chrome/browser/ui/extensions/application_launch.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 if (disposition == CURRENT_TAB) { | 270 if (disposition == CURRENT_TAB) { |
271 WebContents* existing_tab = | 271 WebContents* existing_tab = |
272 browser->tab_strip_model()->GetActiveWebContents(); | 272 browser->tab_strip_model()->GetActiveWebContents(); |
273 TabStripModel* model = browser->tab_strip_model(); | 273 TabStripModel* model = browser->tab_strip_model(); |
274 int tab_index = model->GetIndexOfWebContents(existing_tab); | 274 int tab_index = model->GetIndexOfWebContents(existing_tab); |
275 | 275 |
276 existing_tab->OpenURL(content::OpenURLParams( | 276 existing_tab->OpenURL(content::OpenURLParams( |
277 extension_url, | 277 extension_url, |
278 content::Referrer(existing_tab->GetURL(), | 278 content::Referrer(existing_tab->GetURL(), |
279 WebKit::WebReferrerPolicyDefault), | 279 blink::WebReferrerPolicyDefault), |
280 disposition, content::PAGE_TRANSITION_LINK, false)); | 280 disposition, content::PAGE_TRANSITION_LINK, false)); |
281 // Reset existing_tab as OpenURL() may have clobbered it. | 281 // Reset existing_tab as OpenURL() may have clobbered it. |
282 existing_tab = browser->tab_strip_model()->GetActiveWebContents(); | 282 existing_tab = browser->tab_strip_model()->GetActiveWebContents(); |
283 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { | 283 if (params.tabstrip_add_types & TabStripModel::ADD_PINNED) { |
284 model->SetTabPinned(tab_index, true); | 284 model->SetTabPinned(tab_index, true); |
285 // Pinning may have moved the tab. | 285 // Pinning may have moved the tab. |
286 tab_index = model->GetIndexOfWebContents(existing_tab); | 286 tab_index = model->GetIndexOfWebContents(existing_tab); |
287 } | 287 } |
288 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) | 288 if (params.tabstrip_add_types & TabStripModel::ADD_ACTIVE) |
289 model->ActivateTabAt(tab_index, true); | 289 model->ActivateTabAt(tab_index, true); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when | 487 // up in LoadingStateChanged to schedule a GetApplicationInfo. And when |
488 // the web app info is available, extensions::TabHelper notifies Browser via | 488 // the web app info is available, extensions::TabHelper notifies Browser via |
489 // OnDidGetApplicationInfo, which calls | 489 // OnDidGetApplicationInfo, which calls |
490 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as | 490 // web_app::UpdateShortcutForTabContents when it sees UPDATE_SHORTCUT as |
491 // pending web app action. | 491 // pending web app action. |
492 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( | 492 extensions::TabHelper::FromWebContents(tab)->set_pending_web_app_action( |
493 extensions::TabHelper::UPDATE_SHORTCUT); | 493 extensions::TabHelper::UPDATE_SHORTCUT); |
494 | 494 |
495 return tab; | 495 return tab; |
496 } | 496 } |
OLD | NEW |