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

Unified Diff: chrome/browser/ui/browser_finder.cc

Issue 1198313003: Fix the browser match rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address sky@'s comment. Created 5 years, 5 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
Index: chrome/browser/ui/browser_finder.cc
diff --git a/chrome/browser/ui/browser_finder.cc b/chrome/browser/ui/browser_finder.cc
index 4b5fe8eb6a6d62139e25f8a57567f22db9e1bb29..e4198d48bab1a9e1645d232f8e95dd0e489dd5c0 100644
--- a/chrome/browser/ui/browser_finder.cc
+++ b/chrome/browser/ui/browser_finder.cc
@@ -42,25 +42,23 @@ bool BrowserMatches(Browser* browser,
Profile* profile,
Browser::WindowFeature window_feature,
uint32 match_types) {
- if (match_types & kMatchCanSupportWindowFeature &&
+ if ((match_types & kMatchCanSupportWindowFeature) &&
!browser->CanSupportWindowFeature(window_feature)) {
return false;
}
- bool matches_profile = browser->profile() == profile;
#if defined(OS_CHROMEOS)
// Get the profile on which the window is currently shown.
// MultiUserWindowManager might be NULL under test scenario.
chrome::MultiUserWindowManager* const window_manager =
chrome::MultiUserWindowManager::GetInstance();
+ Profile* shown_profile = nullptr;
if (window_manager) {
const std::string& shown_user_id = window_manager->GetUserPresentingWindow(
browser->window()->GetNativeWindow());
- Profile* shown_profile =
- shown_user_id.empty()
- ? nullptr
- : multi_user_util::GetProfileFromUserID(shown_user_id);
- matches_profile &= !shown_profile || shown_profile == profile;
+ shown_profile = shown_user_id.empty()
+ ? nullptr
+ : multi_user_util::GetProfileFromUserID(shown_user_id);
}
#endif
@@ -68,8 +66,19 @@ bool BrowserMatches(Browser* browser,
if (browser->profile()->GetOriginalProfile() !=
profile->GetOriginalProfile())
return false;
- } else if (!matches_profile) {
- return false;
+#if defined(OS_CHROMEOS)
+ if (shown_profile &&
+ shown_profile->GetOriginalProfile() != profile->GetOriginalProfile()) {
+ return false;
+ }
+#endif
+ } else {
+ if (browser->profile() != profile)
+ return false;
+#if defined(OS_CHROMEOS)
+ if (shown_profile && shown_profile != profile)
+ return false;
+#endif
}
if (match_types & kMatchTabbed)
« no previous file with comments | « chrome/browser/ui/ash/window_positioner_unittest.cc ('k') | chrome/browser/ui/browser_finder_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698