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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 OpenApplication(params); | 525 OpenApplication(params); |
526 } else { | 526 } else { |
527 // To give a more "launchy" experience when using the NTP launcher, we close | 527 // To give a more "launchy" experience when using the NTP launcher, we close |
528 // it automatically. | 528 // it automatically. |
529 Browser* browser = chrome::FindBrowserWithWebContents( | 529 Browser* browser = chrome::FindBrowserWithWebContents( |
530 web_ui()->GetWebContents()); | 530 web_ui()->GetWebContents()); |
531 WebContents* old_contents = NULL; | 531 WebContents* old_contents = NULL; |
532 if (browser) | 532 if (browser) |
533 old_contents = browser->tab_strip_model()->GetActiveWebContents(); | 533 old_contents = browser->tab_strip_model()->GetActiveWebContents(); |
534 | 534 |
535 AppLaunchParams params(profile, extension, | 535 AppLaunchParams params = CreateAppLaunchParamsUserContainer( |
536 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB, | 536 profile, extension, old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB, |
537 extensions::SOURCE_NEW_TAB_PAGE); | 537 extensions::SOURCE_NEW_TAB_PAGE); |
538 params.override_url = GURL(url); | 538 params.override_url = GURL(url); |
539 WebContents* new_contents = OpenApplication(params); | 539 WebContents* new_contents = OpenApplication(params); |
540 | 540 |
541 // This will also destroy the handler, so do not perform any actions after. | 541 // This will also destroy the handler, so do not perform any actions after. |
542 if (new_contents != old_contents && browser && | 542 if (new_contents != old_contents && browser && |
543 browser->tab_strip_model()->count() > 1) { | 543 browser->tab_strip_model()->count() > 1) { |
544 chrome::CloseWebContents(browser, old_contents, true); | 544 chrome::CloseWebContents(browser, old_contents, true); |
545 } | 545 } |
546 } | 546 } |
547 } | 547 } |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 base::FundamentalValue(!extension_id_prompting_.empty())); | 879 base::FundamentalValue(!extension_id_prompting_.empty())); |
880 } | 880 } |
881 | 881 |
882 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { | 882 bool AppLauncherHandler::ShouldShow(const Extension* extension) const { |
883 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) | 883 if (ignore_changes_ || !has_loaded_apps_ || !extension->is_app()) |
884 return false; | 884 return false; |
885 | 885 |
886 Profile* profile = Profile::FromWebUI(web_ui()); | 886 Profile* profile = Profile::FromWebUI(web_ui()); |
887 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); | 887 return extensions::ui_util::ShouldDisplayInNewTabPage(extension, profile); |
888 } | 888 } |
OLD | NEW |