Chromium Code Reviews| Index: chrome/browser/chrome_content_browser_client.cc |
| diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
| index e90776dd85cb24093ca8470a701097d0c9d1c0ce..bbabcf20ac11ce9440571323763cbcc23113b93b 100644 |
| --- a/chrome/browser/chrome_content_browser_client.cc |
| +++ b/chrome/browser/chrome_content_browser_client.cc |
| @@ -91,8 +91,10 @@ |
| #include "chrome/browser/translate/chrome_translate_client.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/browser_finder.h" |
| #include "chrome/browser/ui/browser_navigator.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/sync/sync_promo_ui.h" |
| #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
| @@ -539,20 +541,31 @@ class ChromeServiceChromeOS : public service_manager::Service, |
| // mash::mojom::Launchable: |
| void Launch(uint32_t what, mash::mojom::LaunchMode how) override { |
| - if (how != mash::mojom::LaunchMode::MAKE_NEW) { |
| - LOG(ERROR) << "Unable to handle Launch request with how = " << how; |
| - return; |
| - } |
| + bool is_incognito; |
| switch (what) { |
| case mash::mojom::kWindow: |
| - CreateNewWindowImpl(false /* is_incognito */); |
| + is_incognito = false; |
| break; |
| case mash::mojom::kIncognitoWindow: |
| - CreateNewWindowImpl(true /* is_incognito */); |
| + is_incognito = true; |
| break; |
| default: |
| NOTREACHED(); |
| } |
| + |
| + bool reuse = how == mash::mojom::LaunchMode::REUSE || |
| + how == mash::mojom::LaunchMode::DEFAULT; |
|
sadrul
2017/06/01 19:32:38
Instead of checking REUSE or DEFAULT, just check t
alexanderdai
2017/06/01 21:11:33
Done.
|
| + 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, |