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

Side by Side Diff: chrome/browser/ui/browser_navigator.cc

Issue 1428213004: This CL replaces std::string user_id in ash/* with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 1 month 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
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/browser_navigator.h" 5 #include "chrome/browser/ui/browser_navigator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" 32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
33 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "content/public/browser/browser_url_handler.h" 34 #include "content/public/browser/browser_url_handler.h"
35 #include "content/public/browser/navigation_entry.h" 35 #include "content/public/browser/navigation_entry.h"
36 #include "content/public/browser/notification_service.h" 36 #include "content/public/browser/notification_service.h"
37 #include "content/public/browser/render_view_host.h" 37 #include "content/public/browser/render_view_host.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 39
40 #if defined(USE_ASH) 40 #if defined(USE_ASH)
41 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 41 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
42 #include "components/signin/core/account_id/account_id.h"
42 #endif 43 #endif
43 44
44 #if defined(USE_AURA) 45 #if defined(USE_AURA)
45 #include "ui/aura/window.h" 46 #include "ui/aura/window.h"
46 #endif 47 #endif
47 48
48 #if defined(ENABLE_EXTENSIONS) 49 #if defined(ENABLE_EXTENSIONS)
49 #include "chrome/browser/extensions/tab_helper.h" 50 #include "chrome/browser/extensions/tab_helper.h"
50 #include "chrome/browser/web_applications/web_app.h" 51 #include "chrome/browser/web_applications/web_app.h"
51 #include "extensions/browser/extension_registry.h" 52 #include "extensions/browser/extension_registry.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 #if defined(USE_ASH) 440 #if defined(USE_ASH)
440 if (source_browser && source_browser != params->browser) { 441 if (source_browser && source_browser != params->browser) {
441 // When the newly created browser was spawned by a browser which visits 442 // When the newly created browser was spawned by a browser which visits
442 // another user's desktop, it should be shown on the same desktop as the 443 // another user's desktop, it should be shown on the same desktop as the
443 // originating one. (This is part of the desktop separation per profile). 444 // originating one. (This is part of the desktop separation per profile).
444 MultiUserWindowManager* manager = MultiUserWindowManager::GetInstance(); 445 MultiUserWindowManager* manager = MultiUserWindowManager::GetInstance();
445 // Some unit tests have no manager instantiated. 446 // Some unit tests have no manager instantiated.
446 if (manager) { 447 if (manager) {
447 aura::Window* src_window = source_browser->window()->GetNativeWindow(); 448 aura::Window* src_window = source_browser->window()->GetNativeWindow();
448 aura::Window* new_window = params->browser->window()->GetNativeWindow(); 449 aura::Window* new_window = params->browser->window()->GetNativeWindow();
449 const std::string& src_user = 450 const AccountId& src_account_id =
450 manager->GetUserPresentingWindow(src_window); 451 manager->GetUserPresentingWindow(src_window);
451 if (src_user != manager->GetUserPresentingWindow(new_window)) { 452 if (src_account_id != manager->GetUserPresentingWindow(new_window)) {
452 // Once the window gets presented, it should be shown on the same 453 // Once the window gets presented, it should be shown on the same
453 // desktop as the desktop of the creating browser. Note that this 454 // desktop as the desktop of the creating browser. Note that this
454 // command will not show the window if it wasn't shown yet by the 455 // command will not show the window if it wasn't shown yet by the
455 // browser creation. 456 // browser creation.
456 manager->ShowWindowForUser(new_window, src_user); 457 manager->ShowWindowForUser(new_window, src_account_id);
457 } 458 }
458 } 459 }
459 } 460 }
460 #endif 461 #endif
461 462
462 // Navigate() must not return early after this point. 463 // Navigate() must not return early after this point.
463 464
464 if (GetSourceProfile(params) != params->browser->profile()) { 465 if (GetSourceProfile(params) != params->browser->profile()) {
465 // A tab is being opened from a link from a different profile, we must reset 466 // A tab is being opened from a link from a different profile, we must reset
466 // source information that may cause state to be shared. 467 // source information that may cause state to be shared.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 bool reverse_on_redirect = false; 660 bool reverse_on_redirect = false;
660 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( 661 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary(
661 &rewritten_url, browser_context, &reverse_on_redirect); 662 &rewritten_url, browser_context, &reverse_on_redirect);
662 663
663 // Some URLs are mapped to uber subpages. Do not allow them in incognito. 664 // Some URLs are mapped to uber subpages. Do not allow them in incognito.
664 return !(rewritten_url.scheme() == content::kChromeUIScheme && 665 return !(rewritten_url.scheme() == content::kChromeUIScheme &&
665 rewritten_url.host() == chrome::kChromeUIUberHost); 666 rewritten_url.host() == chrome::kChromeUIUberHost);
666 } 667 }
667 668
668 } // namespace chrome 669 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_finder_chromeos_unittest.cc ('k') | chrome/browser/ui/browser_navigator_browsertest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698