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" |
11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
17 #include "chrome/app/chrome_dll_resource.h" | 17 #include "chrome/app/chrome_dll_resource.h" |
18 #include "chrome/browser/app_mode/app_mode_utils.h" | 18 #include "chrome/browser/app_mode/app_mode_utils.h" |
19 #include "chrome/browser/bookmarks/bookmark_stats.h" | 19 #include "chrome/browser/bookmarks/bookmark_stats.h" |
20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 21 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/extensions/tab_helper.h" | 22 #include "chrome/browser/extensions/tab_helper.h" |
23 #include "chrome/browser/infobars/infobar_service.h" | 23 #include "chrome/browser/infobars/infobar_service.h" |
24 #include "chrome/browser/native_window_notification_source.h" | 24 #include "chrome/browser/native_window_notification_source.h" |
25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 25 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
26 #include "chrome/browser/profiles/avatar_menu.h" | 26 #include "chrome/browser/profiles/avatar_menu.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
28 #include "chrome/browser/profiles/profile_info_cache.h" | 29 #include "chrome/browser/profiles/profile_info_cache.h" |
29 #include "chrome/browser/profiles/profile_manager.h" | 30 #include "chrome/browser/profiles/profile_manager.h" |
30 #include "chrome/browser/profiles/profiles_state.h" | 31 #include "chrome/browser/profiles/profiles_state.h" |
31 #include "chrome/browser/search/search.h" | 32 #include "chrome/browser/search/search.h" |
32 #include "chrome/browser/sessions/tab_restore_service.h" | 33 #include "chrome/browser/sessions/tab_restore_service.h" |
33 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
34 #include "chrome/browser/speech/tts_controller.h" | 35 #include "chrome/browser/speech/tts_controller.h" |
35 #include "chrome/browser/themes/theme_properties.h" | 36 #include "chrome/browser/themes/theme_properties.h" |
36 #include "chrome/browser/themes/theme_service_factory.h" | 37 #include "chrome/browser/themes/theme_service_factory.h" |
37 #include "chrome/browser/translate/translate_tab_helper.h" | 38 #include "chrome/browser/translate/translate_tab_helper.h" |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 576 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
576 #if defined(OS_WIN) | 577 #if defined(OS_WIN) |
577 if (win8::IsSingleWindowMetroMode()) | 578 if (win8::IsSingleWindowMetroMode()) |
578 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 579 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
579 #endif | 580 #endif |
580 } | 581 } |
581 | 582 |
582 return otr_resource_id; | 583 return otr_resource_id; |
583 } | 584 } |
584 | 585 |
585 int BrowserView::GetGuestIconResourceID() const { | |
586 return IDR_LOGIN_GUEST; | |
587 } | |
588 | |
589 bool BrowserView::ShouldShowAvatar() const { | 586 bool BrowserView::ShouldShowAvatar() const { |
590 #if defined(OS_CHROMEOS) | 587 #if defined(OS_CHROMEOS) |
591 if (!browser_->is_type_tabbed() && !browser_->is_app()) | 588 if (!browser_->is_type_tabbed() && !browser_->is_app()) |
592 return false; | 589 return false; |
593 // Don't show incognito avatar in the guest session. | 590 // Don't show incognito avatar in the guest session. |
594 if (IsOffTheRecord() && !IsGuestSession()) | 591 if (IsOffTheRecord() && !IsGuestSession()) |
595 return true; | 592 return true; |
596 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 593 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
597 // during the creation of the BrowserWindow, so browser->window() will not | 594 // during the creation of the BrowserWindow, so browser->window() will not |
598 // yet be set. In this case we can safely return false. | 595 // yet be set. In this case we can safely return false. |
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2579 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2583 gfx::Point icon_bottom( | 2580 gfx::Point icon_bottom( |
2584 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2581 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2585 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2582 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2586 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2583 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2587 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2584 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2588 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2585 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2589 } | 2586 } |
2590 return top_arrow_height; | 2587 return top_arrow_height; |
2591 } | 2588 } |
OLD | NEW |