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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 bool BrowserView::IsRegularOrGuestSession() const { | 555 bool BrowserView::IsRegularOrGuestSession() const { |
555 return profiles::IsRegularOrGuestSession(browser_.get()); | 556 return profiles::IsRegularOrGuestSession(browser_.get()); |
556 } | 557 } |
557 | 558 |
558 int BrowserView::GetOTRIconResourceID() const { | 559 int BrowserView::GetOTRIconResourceID() const { |
559 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && IsFullscreen()) | 560 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH && IsFullscreen()) |
560 return IDR_OTR_ICON_FULLSCREEN; | 561 return IDR_OTR_ICON_FULLSCREEN; |
561 return IDR_OTR_ICON; | 562 return IDR_OTR_ICON; |
562 } | 563 } |
563 | 564 |
564 int BrowserView::GetGuestIconResourceID() const { | |
565 return IDR_LOGIN_GUEST; | |
566 } | |
567 | |
568 bool BrowserView::ShouldShowAvatar() const { | 565 bool BrowserView::ShouldShowAvatar() const { |
569 #if defined(OS_CHROMEOS) | 566 #if defined(OS_CHROMEOS) |
570 if (!browser_->is_type_tabbed() && !browser_->is_app()) | 567 if (!browser_->is_type_tabbed() && !browser_->is_app()) |
571 return false; | 568 return false; |
572 // Don't show incognito avatar in the guest session. | 569 // Don't show incognito avatar in the guest session. |
573 if (IsOffTheRecord() && !IsGuestSession()) | 570 if (IsOffTheRecord() && !IsGuestSession()) |
574 return true; | 571 return true; |
575 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 572 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
576 // during the creation of the BrowserWindow, so browser->window() will not | 573 // during the creation of the BrowserWindow, so browser->window() will not |
577 // yet be set. In this case we can safely return false. | 574 // yet be set. In this case we can safely return false. |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2556 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2553 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
2557 gfx::Point icon_bottom( | 2554 gfx::Point icon_bottom( |
2558 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2555 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
2559 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2556 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
2560 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2557 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
2561 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2558 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
2562 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2559 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
2563 } | 2560 } |
2564 return top_arrow_height; | 2561 return top_arrow_height; |
2565 } | 2562 } |
OLD | NEW |