| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" | 76 #include "chrome/browser/ui/views/frame/contents_layout_manager.h" |
| 77 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 77 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 78 #include "chrome/browser/ui/views/frame/top_container_view.h" | 78 #include "chrome/browser/ui/views/frame/top_container_view.h" |
| 79 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 79 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
| 80 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" | 80 #include "chrome/browser/ui/views/ime/ime_warning_bubble_view.h" |
| 81 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" | 81 #include "chrome/browser/ui/views/infobars/infobar_container_view.h" |
| 82 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 82 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 83 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 83 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 84 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 84 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 85 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 85 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 86 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | |
| 87 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 86 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
| 87 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
| 88 #include "chrome/browser/ui/views/session_crashed_bubble_view.h" | 88 #include "chrome/browser/ui/views/session_crashed_bubble_view.h" |
| 89 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" | 89 #include "chrome/browser/ui/views/settings_api_bubble_helper_views.h" |
| 90 #include "chrome/browser/ui/views/status_bubble_views.h" | 90 #include "chrome/browser/ui/views/status_bubble_views.h" |
| 91 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" | 91 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" |
| 92 #include "chrome/browser/ui/views/tabs/tab.h" | 92 #include "chrome/browser/ui/views/tabs/tab.h" |
| 93 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 93 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 94 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 94 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 95 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" | 95 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" |
| 96 #include "chrome/browser/ui/views/toolbar/reload_button.h" | 96 #include "chrome/browser/ui/views/toolbar/reload_button.h" |
| 97 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 97 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 #include "ui/gfx/color_palette.h" | 170 #include "ui/gfx/color_palette.h" |
| 171 #include "ui/native_theme/native_theme_dark_win.h" | 171 #include "ui/native_theme/native_theme_dark_win.h" |
| 172 #include "ui/views/win/scoped_fullscreen_visibility.h" | 172 #include "ui/views/win/scoped_fullscreen_visibility.h" |
| 173 #endif | 173 #endif |
| 174 | 174 |
| 175 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) | 175 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) |
| 176 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" | 176 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" |
| 177 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" | 177 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" |
| 178 #endif | 178 #endif |
| 179 | 179 |
| 180 #if defined(OS_CHROMEOS) | |
| 181 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" | |
| 182 #endif | |
| 183 | |
| 184 #if defined(OS_LINUX) | 180 #if defined(OS_LINUX) |
| 185 #include "ui/native_theme/native_theme_dark_aura.h" | 181 #include "ui/native_theme/native_theme_dark_aura.h" |
| 186 #endif | 182 #endif |
| 187 | 183 |
| 188 using base::TimeDelta; | 184 using base::TimeDelta; |
| 189 using base::UserMetricsAction; | 185 using base::UserMetricsAction; |
| 190 using content::NativeWebKeyboardEvent; | 186 using content::NativeWebKeyboardEvent; |
| 191 using content::WebContents; | 187 using content::WebContents; |
| 192 using views::ColumnSet; | 188 using views::ColumnSet; |
| 193 using views::GridLayout; | 189 using views::GridLayout; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 606 } |
| 611 | 607 |
| 612 bool BrowserView::IsGuestSession() const { | 608 bool BrowserView::IsGuestSession() const { |
| 613 return browser_->profile()->IsGuestSession(); | 609 return browser_->profile()->IsGuestSession(); |
| 614 } | 610 } |
| 615 | 611 |
| 616 bool BrowserView::IsRegularOrGuestSession() const { | 612 bool BrowserView::IsRegularOrGuestSession() const { |
| 617 return profiles::IsRegularOrGuestSession(browser_.get()); | 613 return profiles::IsRegularOrGuestSession(browser_.get()); |
| 618 } | 614 } |
| 619 | 615 |
| 620 bool BrowserView::ShouldShowAvatar() const { | |
| 621 #if defined(OS_CHROMEOS) | |
| 622 if (!browser_->is_type_tabbed() && !browser_->is_app()) | |
| 623 return false; | |
| 624 // Don't show incognito avatar in the guest session. | |
| 625 if (IsOffTheRecord() && !IsGuestSession()) | |
| 626 return true; | |
| 627 return chrome::MultiUserWindowManager::ShouldShowAvatar(GetNativeWindow()); | |
| 628 #else | |
| 629 if (!IsBrowserTypeNormal()) | |
| 630 return false; | |
| 631 if (IsOffTheRecord()) // Desktop guest is incognito and needs avatar. | |
| 632 return true; | |
| 633 // Tests may not have a profile manager. | |
| 634 if (!g_browser_process->profile_manager()) | |
| 635 return false; | |
| 636 ProfileAttributesEntry* entry; | |
| 637 if (!g_browser_process->profile_manager()->GetProfileAttributesStorage(). | |
| 638 GetProfileAttributesWithPath(browser_->profile()->GetPath(), &entry)) { | |
| 639 return false; | |
| 640 } | |
| 641 | |
| 642 return AvatarMenu::ShouldShowAvatarMenu(); | |
| 643 #endif | |
| 644 } | |
| 645 | |
| 646 bool BrowserView::GetAccelerator(int cmd_id, | 616 bool BrowserView::GetAccelerator(int cmd_id, |
| 647 ui::Accelerator* accelerator) const { | 617 ui::Accelerator* accelerator) const { |
| 648 // We retrieve the accelerator information for standard accelerators | 618 // We retrieve the accelerator information for standard accelerators |
| 649 // for cut, copy and paste. | 619 // for cut, copy and paste. |
| 650 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) | 620 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) |
| 651 return true; | 621 return true; |
| 652 // Else, we retrieve the accelerator information from the accelerator table. | 622 // Else, we retrieve the accelerator information from the accelerator table. |
| 653 for (std::map<ui::Accelerator, int>::const_iterator it = | 623 for (std::map<ui::Accelerator, int>::const_iterator it = |
| 654 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { | 624 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { |
| 655 if (it->second == cmd_id) { | 625 if (it->second == cmd_id) { |
| (...skipping 1980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 } | 2606 } |
| 2637 | 2607 |
| 2638 extensions::ActiveTabPermissionGranter* | 2608 extensions::ActiveTabPermissionGranter* |
| 2639 BrowserView::GetActiveTabPermissionGranter() { | 2609 BrowserView::GetActiveTabPermissionGranter() { |
| 2640 content::WebContents* web_contents = GetActiveWebContents(); | 2610 content::WebContents* web_contents = GetActiveWebContents(); |
| 2641 if (!web_contents) | 2611 if (!web_contents) |
| 2642 return nullptr; | 2612 return nullptr; |
| 2643 return extensions::TabHelper::FromWebContents(web_contents) | 2613 return extensions::TabHelper::FromWebContents(web_contents) |
| 2644 ->active_tab_permission_granter(); | 2614 ->active_tab_permission_granter(); |
| 2645 } | 2615 } |
| OLD | NEW |