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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2920473003: Fix chrome not launching through quick_launch (Closed)
Patch Set: check not MAKE_NEW instead of REUSE or DEFAULT Created 3 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e9666ad2df4f51a07d0e9f007886743c8f96ca95 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,30 @@ 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::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,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698