| 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" | |
| 29 #include "chrome/browser/profiles/profile_info_cache.h" | 28 #include "chrome/browser/profiles/profile_info_cache.h" |
| 30 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 31 #include "chrome/browser/profiles/profiles_state.h" | 30 #include "chrome/browser/profiles/profiles_state.h" |
| 32 #include "chrome/browser/search/search.h" | 31 #include "chrome/browser/search/search.h" |
| 33 #include "chrome/browser/sessions/tab_restore_service.h" | 32 #include "chrome/browser/sessions/tab_restore_service.h" |
| 34 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 33 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 35 #include "chrome/browser/speech/tts_controller.h" | 34 #include "chrome/browser/speech/tts_controller.h" |
| 36 #include "chrome/browser/themes/theme_properties.h" | 35 #include "chrome/browser/themes/theme_properties.h" |
| 37 #include "chrome/browser/themes/theme_service_factory.h" | 36 #include "chrome/browser/themes/theme_service_factory.h" |
| 38 #include "chrome/browser/translate/translate_tab_helper.h" | 37 #include "chrome/browser/translate/translate_tab_helper.h" |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 576 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
| 578 #if defined(OS_WIN) | 577 #if defined(OS_WIN) |
| 579 if (win8::IsSingleWindowMetroMode()) | 578 if (win8::IsSingleWindowMetroMode()) |
| 580 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; | 579 otr_resource_id = IDR_OTR_ICON_FULLSCREEN; |
| 581 #endif | 580 #endif |
| 582 } | 581 } |
| 583 | 582 |
| 584 return otr_resource_id; | 583 return otr_resource_id; |
| 585 } | 584 } |
| 586 | 585 |
| 586 int BrowserView::GetGuestIconResourceID() const { |
| 587 return IDR_LOGIN_GUEST; |
| 588 } |
| 589 |
| 587 bool BrowserView::ShouldShowAvatar() const { | 590 bool BrowserView::ShouldShowAvatar() const { |
| 588 #if defined(OS_CHROMEOS) | 591 #if defined(OS_CHROMEOS) |
| 589 if (!browser_->is_type_tabbed() && !browser_->is_app()) | 592 if (!browser_->is_type_tabbed() && !browser_->is_app()) |
| 590 return false; | 593 return false; |
| 591 // Don't show incognito avatar in the guest session. | 594 // Don't show incognito avatar in the guest session. |
| 592 if (IsOffTheRecord() && !IsGuestSession()) | 595 if (IsOffTheRecord() && !IsGuestSession()) |
| 593 return true; | 596 return true; |
| 594 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo | 597 // This function is called via BrowserNonClientFrameView::UpdateAvatarInfo |
| 595 // during the creation of the BrowserWindow, so browser->window() will not | 598 // during the creation of the BrowserWindow, so browser->window() will not |
| 596 // yet be set. In this case we can safely return false. | 599 // yet be set. In this case we can safely return false. |
| (...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2594 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { | 2597 !GetLocationBar()->GetOmniboxView()->model()->popup_model()->IsOpen()) { |
| 2595 gfx::Point icon_bottom( | 2598 gfx::Point icon_bottom( |
| 2596 toolbar_->location_bar()->GetLocationBarAnchorPoint()); | 2599 toolbar_->location_bar()->GetLocationBarAnchorPoint()); |
| 2597 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); | 2600 ConvertPointToTarget(toolbar_->location_bar(), this, &icon_bottom); |
| 2598 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2601 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2599 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2602 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2600 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2603 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2601 } | 2604 } |
| 2602 return top_arrow_height; | 2605 return top_arrow_height; |
| 2603 } | 2606 } |
| OLD | NEW |