| 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/webui/ntp/app_launcher_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "apps/metrics_names.h" | 9 #include "apps/metrics_names.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 | 519 |
| 520 if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB || | 520 if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB || |
| 521 disposition == NEW_WINDOW) { | 521 disposition == NEW_WINDOW) { |
| 522 // TODO(jamescook): Proper support for background tabs. | 522 // TODO(jamescook): Proper support for background tabs. |
| 523 AppLaunchParams params(profile, extension, | 523 AppLaunchParams params(profile, extension, |
| 524 disposition == NEW_WINDOW ? | 524 disposition == NEW_WINDOW ? |
| 525 extensions::LAUNCH_CONTAINER_WINDOW : | 525 extensions::LAUNCH_CONTAINER_WINDOW : |
| 526 extensions::LAUNCH_CONTAINER_TAB, | 526 extensions::LAUNCH_CONTAINER_TAB, |
| 527 disposition); | 527 disposition); |
| 528 params.override_url = GURL(url); | 528 params.override_url = GURL(url); |
| 529 params.source = extensions::SOURCE_NEW_TAB_PAGE; |
| 529 OpenApplication(params); | 530 OpenApplication(params); |
| 530 } else { | 531 } else { |
| 531 // To give a more "launchy" experience when using the NTP launcher, we close | 532 // To give a more "launchy" experience when using the NTP launcher, we close |
| 532 // it automatically. | 533 // it automatically. |
| 533 Browser* browser = chrome::FindBrowserWithWebContents( | 534 Browser* browser = chrome::FindBrowserWithWebContents( |
| 534 web_ui()->GetWebContents()); | 535 web_ui()->GetWebContents()); |
| 535 WebContents* old_contents = NULL; | 536 WebContents* old_contents = NULL; |
| 536 if (browser) | 537 if (browser) |
| 537 old_contents = browser->tab_strip_model()->GetActiveWebContents(); | 538 old_contents = browser->tab_strip_model()->GetActiveWebContents(); |
| 538 | 539 |
| 539 AppLaunchParams params(profile, extension, | 540 AppLaunchParams params(profile, extension, |
| 540 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); | 541 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); |
| 541 params.override_url = GURL(url); | 542 params.override_url = GURL(url); |
| 543 params.source = extensions::SOURCE_NEW_TAB_PAGE; |
| 542 WebContents* new_contents = OpenApplication(params); | 544 WebContents* new_contents = OpenApplication(params); |
| 543 | 545 |
| 544 // This will also destroy the handler, so do not perform any actions after. | 546 // This will also destroy the handler, so do not perform any actions after. |
| 545 if (new_contents != old_contents && browser && | 547 if (new_contents != old_contents && browser && |
| 546 browser->tab_strip_model()->count() > 1) { | 548 browser->tab_strip_model()->count() > 1) { |
| 547 chrome::CloseWebContents(browser, old_contents, true); | 549 chrome::CloseWebContents(browser, old_contents, true); |
| 548 } | 550 } |
| 549 } | 551 } |
| 550 } | 552 } |
| 551 | 553 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 Browser* browser = chrome::FindBrowserWithWebContents( | 846 Browser* browser = chrome::FindBrowserWithWebContents( |
| 845 web_ui()->GetWebContents()); | 847 web_ui()->GetWebContents()); |
| 846 extension_uninstall_dialog_.reset( | 848 extension_uninstall_dialog_.reset( |
| 847 extensions::ExtensionUninstallDialog::Create( | 849 extensions::ExtensionUninstallDialog::Create( |
| 848 extension_service_->profile(), | 850 extension_service_->profile(), |
| 849 browser->window()->GetNativeWindow(), | 851 browser->window()->GetNativeWindow(), |
| 850 this)); | 852 this)); |
| 851 } | 853 } |
| 852 return extension_uninstall_dialog_.get(); | 854 return extension_uninstall_dialog_.get(); |
| 853 } | 855 } |
| OLD | NEW |