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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 577 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
577 #if defined(OS_WIN) | 578 #if defined(OS_WIN) |
578 if (win8::IsSingleWindowMetroMode()) | 579 if (win8::IsSingleWindowMetroMode()) |
579 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 580 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
580 #endif | 581 #endif |
581 } | 582 } |
582 | 583 |
583 return otr_resource_id; | 584 return otr_resource_id; |
584 } | 585 } |
585 | 586 |
586 int BrowserView::GetGuestIconResourceID() const { | |
587 return IDR_LOGIN_GUEST; | |
588 } | |
589 | |
590 bool BrowserView::ShouldShowAvatar() const { | 587 bool BrowserView::ShouldShowAvatar() const { |
591 #if defined(OS_CHROMEOS) | 588 #if defined(OS_CHROMEOS) |
592 if (!browser_->is_type_tabbed() && !browser_->is_app()) | 589 if (!browser_->is_type_tabbed() && !browser_->is_app()) |
593 return false; | 590 return false; |
594 // Don't show incognito avatar in the guest session. | 591 // Don't show incognito avatar in the guest session. |
595 if (IsOffTheRecord() && !IsGuestSession()) | 592 if (IsOffTheRecord() && !IsGuestSession()) |
596 return true; | 593 return true; |
597 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 594 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
598 // during the creation of the BrowserWindow, so browser->window() will not | 595 // during the creation of the BrowserWindow, so browser->window() will not |
599 // yet be set. In this case we can safely return false. | 596 // yet be set. In this case we can safely return false. |
(...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2599 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2603 gfx::Point icon_bottom( | 2600 gfx::Point icon_bottom( |
2604 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2601 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2605 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2602 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2606 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2603 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2607 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2604 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2608 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2605 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2609 } | 2606 } |
2610 return top_arrow_height; | 2607 return top_arrow_height; |
2611 } | 2608 } |
OLD | NEW |