Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/views/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 int BrowserView::GetGuestIconResourceID() const { | 584 int BrowserView::GetGuestIconResourceID() const { |
| 585 return IDR_LOGIN_GUEST; | 585 return IDR_LOGIN_GUEST; |
| 586 } | 586 } |
| 587 | 587 |
| 588 bool BrowserView::ShouldShowAvatar() const { | 588 bool BrowserView::ShouldShowAvatar() const { |
| 589 if (!IsBrowserTypeNormal()) | 589 if (!IsBrowserTypeNormal()) |
| 590 return false; | 590 return false; |
| 591 #if defined(OS_CHROMEOS) | 591 #if defined(OS_CHROMEOS) |
| 592 if (IsOffTheRecord() && !IsGuestSession()) | 592 if (IsOffTheRecord() && !IsGuestSession()) |
| 593 return true; | 593 return true; |
| 594 | 594 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
| 595 // Note: In case of the M-31 mode the window manager won't exist. | 595 // during the creation of the BrowserWindow, so browser->window() will not |
| 596 if (chrome::MultiUserWindowManager::GetMultiProfileMode() == | 596 // yet be set. In this case we can safely return false. |
| 597 chrome::MultiUserWindowManager::MULTI_PROFILE_MODE_SEPARATED) { | 597 if (!browser_->window()) |
| 598 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 598 return false; |
| 599 // during the creation of the BrowserWindow, so browser->window() will not | 599 return chrome::MultiUserWindowManager::GetInstance()-> |
| 600 // yet be set. In this case we can safely return false. | 600 ShouldShowAvatar(browser_->window()->GetNativeWindow()); |
| 601 if (!browser_->window()) | |
| 602 return false; | |
| 603 | |
| 604 // If the window is shown on a different desktop than the user, it should | |
| 605 // have the avatar icon. | |
| 606 aura::Window* window = browser_->window()->GetNativeWindow(); | |
| 607 | |
| 608 // Note: When the window manager the window is either on it's owners desktop | |
| 609 // (and shows no icon) or it is now (in which it will show an icon). So we | |
| 610 // can return here. | |
| 611 chrome::MultiUserWindowManager* window_manager = | |
| 612 chrome::MultiUserWindowManager::GetInstance(); | |
| 613 return !window_manager->IsWindowOnDesktopOfUser( | |
| 614 window, | |
| 615 window_manager->GetWindowOwner(window)); | |
| 616 } | |
| 617 #else | 601 #else |
| 618 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar. | 602 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar. |
| 619 return true; | 603 return true; |
| 620 #endif | |
|
oshima
2014/03/12 21:32:36
The rest of the code always returns false for cros
| |
| 621 // Tests may not have a profile manager. | 604 // Tests may not have a profile manager. |
| 622 if (!g_browser_process->profile_manager()) | 605 if (!g_browser_process->profile_manager()) |
| 623 return false; | 606 return false; |
| 624 ProfileInfoCache& cache = | 607 ProfileInfoCache& cache = |
| 625 g_browser_process->profile_manager()->GetProfileInfoCache(); | 608 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 626 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == | 609 if (cache.GetIndexOfProfileWithPath(browser_->profile()->GetPath()) == |
| 627 std::string::npos) { | 610 std::string::npos) { |
| 628 return false; | 611 return false; |
| 629 } | 612 } |
| 630 | 613 |
| 631 return AvatarMenu::ShouldShowAvatarMenu(); | 614 return AvatarMenu::ShouldShowAvatarMenu(); |
| 615 #endif | |
| 632 } | 616 } |
| 633 | 617 |
| 634 bool BrowserView::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { | 618 bool BrowserView::GetAccelerator(int cmd_id, ui::Accelerator* accelerator) { |
| 635 // We retrieve the accelerator information for standard accelerators | 619 // We retrieve the accelerator information for standard accelerators |
| 636 // for cut, copy and paste. | 620 // for cut, copy and paste. |
| 637 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) | 621 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) |
| 638 return true; | 622 return true; |
| 639 // Else, we retrieve the accelerator information from the accelerator table. | 623 // Else, we retrieve the accelerator information from the accelerator table. |
| 640 for (std::map<ui::Accelerator, int>::const_iterator it = | 624 for (std::map<ui::Accelerator, int>::const_iterator it = |
| 641 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { | 625 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { |
| (...skipping 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2577 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2561 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2578 gfx::Point icon_bottom( | 2562 gfx::Point icon_bottom( |
| 2579 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2563 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2580 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2564 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2581 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2565 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2582 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2566 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2583 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2567 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2584 } | 2568 } |
| 2585 return top_arrow_height; | 2569 return top_arrow_height; |
| 2586 } | 2570 } |
| OLD | NEW |