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

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

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | Annotate | Revision Log
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 <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 OpenApplication(params); 505 OpenApplication(params);
506 } else { 506 } else {
507 // Look at preference to find the right launch container. If no preference 507 // Look at preference to find the right launch container. If no preference
508 // is set, launch as a regular tab. 508 // is set, launch as a regular tab.
509 extension_misc::LaunchContainer launch_container = 509 extension_misc::LaunchContainer launch_container =
510 extension_service_->extension_prefs()->GetLaunchContainer( 510 extension_service_->extension_prefs()->GetLaunchContainer(
511 extension, ExtensionPrefs::LAUNCH_REGULAR); 511 extension, ExtensionPrefs::LAUNCH_REGULAR);
512 512
513 // To give a more "launchy" experience when using the NTP launcher, we close 513 // To give a more "launchy" experience when using the NTP launcher, we close
514 // it automatically. 514 // it automatically.
515 Browser* browser = browser::FindBrowserWithWebContents( 515 Browser* browser = chrome::FindBrowserWithWebContents(
516 web_ui()->GetWebContents()); 516 web_ui()->GetWebContents());
517 WebContents* old_contents = NULL; 517 WebContents* old_contents = NULL;
518 if (browser) 518 if (browser)
519 old_contents = chrome::GetActiveWebContents(browser); 519 old_contents = chrome::GetActiveWebContents(browser);
520 520
521 LaunchParams params(profile, extension, launch_container, 521 LaunchParams params(profile, extension, launch_container,
522 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB); 522 old_contents ? CURRENT_TAB : NEW_FOREGROUND_TAB);
523 params.override_url = GURL(url); 523 params.override_url = GURL(url);
524 WebContents* new_contents = OpenApplication(params); 524 WebContents* new_contents = OpenApplication(params);
525 525
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 void AppLauncherHandler::HandleCreateAppShortcut(const ListValue* args) { 581 void AppLauncherHandler::HandleCreateAppShortcut(const ListValue* args) {
582 std::string extension_id; 582 std::string extension_id;
583 CHECK(args->GetString(0, &extension_id)); 583 CHECK(args->GetString(0, &extension_id));
584 584
585 const Extension* extension = 585 const Extension* extension =
586 extension_service_->GetExtensionById(extension_id, true); 586 extension_service_->GetExtensionById(extension_id, true);
587 if (!extension) 587 if (!extension)
588 return; 588 return;
589 589
590 Browser* browser = browser::FindBrowserWithWebContents( 590 Browser* browser = chrome::FindBrowserWithWebContents(
591 web_ui()->GetWebContents()); 591 web_ui()->GetWebContents());
592 browser->window()->ShowCreateChromeAppShortcutsDialog( 592 browser->window()->ShowCreateChromeAppShortcutsDialog(
593 browser->profile(), extension); 593 browser->profile(), extension);
594 } 594 }
595 595
596 void AppLauncherHandler::HandleReorderApps(const ListValue* args) { 596 void AppLauncherHandler::HandleReorderApps(const ListValue* args) {
597 CHECK(args->GetSize() == 2); 597 CHECK(args->GetSize() == 2);
598 598
599 std::string dragged_app_id; 599 std::string dragged_app_id;
600 const ListValue* app_order; 600 const ListValue* app_order;
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 "Extensions.Permissions_ReEnableCancel" : 908 "Extensions.Permissions_ReEnableCancel" :
909 "Extensions.Permissions_ReEnableAbort"; 909 "Extensions.Permissions_ReEnableAbort";
910 ExtensionService::RecordPermissionMessagesHistogram( 910 ExtensionService::RecordPermissionMessagesHistogram(
911 extension, histogram_name.c_str()); 911 extension, histogram_name.c_str());
912 912
913 CleanupAfterUninstall(); 913 CleanupAfterUninstall();
914 } 914 }
915 915
916 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() { 916 ExtensionUninstallDialog* AppLauncherHandler::GetExtensionUninstallDialog() {
917 if (!extension_uninstall_dialog_.get()) { 917 if (!extension_uninstall_dialog_.get()) {
918 Browser* browser = browser::FindBrowserWithWebContents( 918 Browser* browser = chrome::FindBrowserWithWebContents(
919 web_ui()->GetWebContents()); 919 web_ui()->GetWebContents());
920 extension_uninstall_dialog_.reset( 920 extension_uninstall_dialog_.reset(
921 ExtensionUninstallDialog::Create(browser, this)); 921 ExtensionUninstallDialog::Create(browser, this));
922 } 922 }
923 return extension_uninstall_dialog_.get(); 923 return extension_uninstall_dialog_.get();
924 } 924 }
925 925
926 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() { 926 ExtensionInstallPrompt* AppLauncherHandler::GetExtensionInstallPrompt() {
927 if (!extension_install_ui_.get()) { 927 if (!extension_install_ui_.get()) {
928 extension_install_ui_.reset( 928 extension_install_ui_.reset(
929 new ExtensionInstallPrompt(web_ui()->GetWebContents())); 929 new ExtensionInstallPrompt(web_ui()->GetWebContents()));
930 } 930 }
931 return extension_install_ui_.get(); 931 return extension_install_ui_.get();
932 } 932 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698