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

Side by Side Diff: chrome/browser/ui/webui/ntp/app_launcher_handler.cc

Issue 657023008: Add a new field "source" in launchData of chrome.app.runtime.onLaunched() to trace launch source. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 6 years, 1 month 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
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.cc ('k') | extensions/browser/api/app_runtime/app_runtime_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698