Commit 8ea647a2 authored by alexanderdai's avatar alexanderdai Committed by Commit Bot

Fix chrome not launching through quick_launch

Previously, chrome only handled launching with launch mode MAKE_NEW.
Now it can also be launched with launch mode REUSE (which is the mode
quick_launch uses by default) and launch mode DEFAULT (which is
interpreted as REUSE).

Typing chrome into quick_launch restores focus only to the original
chrome window; it doesn't restore focus to chrome windows launched
through quick_launch for some reason.

BUG=727837

Review-Url: https://codereview.chromium.org/2920473003
Cr-Commit-Position: refs/heads/master@{#476482}
parent 3612567b
...@@ -93,8 +93,10 @@ ...@@ -93,8 +93,10 @@
#include "chrome/browser/translate/chrome_translate_client.h" #include "chrome/browser/translate/chrome_translate_client.h"
#include "chrome/browser/ui/blocked_content/blocked_window_params.h" #include "chrome/browser/ui/blocked_content/blocked_window_params.h"
#include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h" #include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_select_file_policy.h" #include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/sync/sync_promo_ui.h" #include "chrome/browser/ui/sync/sync_promo_ui.h"
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
...@@ -542,20 +544,30 @@ class ChromeServiceChromeOS : public service_manager::Service, ...@@ -542,20 +544,30 @@ class ChromeServiceChromeOS : public service_manager::Service,
// mash::mojom::Launchable: // mash::mojom::Launchable:
void Launch(uint32_t what, mash::mojom::LaunchMode how) override { void Launch(uint32_t what, mash::mojom::LaunchMode how) override {
if (how != mash::mojom::LaunchMode::MAKE_NEW) { bool is_incognito;
LOG(ERROR) << "Unable to handle Launch request with how = " << how;
return;
}
switch (what) { switch (what) {
case mash::mojom::kWindow: case mash::mojom::kWindow:
CreateNewWindowImpl(false /* is_incognito */); is_incognito = false;
break; break;
case mash::mojom::kIncognitoWindow: case mash::mojom::kIncognitoWindow:
CreateNewWindowImpl(true /* is_incognito */); is_incognito = true;
break; break;
default: default:
NOTREACHED(); NOTREACHED();
} }
bool reuse = how != mash::mojom::LaunchMode::MAKE_NEW;
if (reuse) {
Profile* profile = ProfileManager::GetActiveUserProfile();
Browser* browser = chrome::FindTabbedBrowser(
is_incognito ? profile->GetOffTheRecordProfile() : profile, false);
if (browser) {
browser->window()->Show();
return;
}
}
CreateNewWindowImpl(is_incognito);
} }
void Create(const service_manager::BindSourceInfo& source_info, void Create(const service_manager::BindSourceInfo& source_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment