| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/opaque_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/browser/themes/theme_service.h" | 15 #include "chrome/browser/themes/theme_service.h" |
| 16 #include "chrome/browser/ui/profile_menu_model.h" | 16 #include "chrome/browser/ui/profile_menu_model.h" |
| 17 #include "chrome/browser/ui/views/avatar_menu_button.h" | 17 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 18 #include "chrome/browser/ui/views/frame/browser_frame.h" | 18 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 19 #include "chrome/browser/ui/views/frame/browser_view.h" | 19 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 20 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 20 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 21 #include "chrome/browser/ui/views/toolbar_view.h" | 21 #include "chrome/browser/ui/views/toolbar_view.h" |
| 22 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| 24 #include "content/browser/tab_contents/tab_contents.h" | 25 #include "content/browser/tab_contents/tab_contents.h" |
| 25 #include "content/common/notification_service.h" | 26 #include "content/common/notification_service.h" |
| 26 #include "grit/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 29 #include "grit/theme_resources_standard.h" | 30 #include "grit/theme_resources_standard.h" |
| 30 #include "grit/ui_resources.h" | 31 #include "grit/ui_resources.h" |
| 31 #include "ui/base/accessibility/accessible_view_state.h" | 32 #include "ui/base/accessibility/accessible_view_state.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 return delegate->GetWindowIcon(); | 508 return delegate->GetWindowIcon(); |
| 508 } | 509 } |
| 509 | 510 |
| 510 /////////////////////////////////////////////////////////////////////////////// | 511 /////////////////////////////////////////////////////////////////////////////// |
| 511 // OpaqueBrowserFrameView, protected: | 512 // OpaqueBrowserFrameView, protected: |
| 512 | 513 |
| 513 void OpaqueBrowserFrameView::Observe(NotificationType type, | 514 void OpaqueBrowserFrameView::Observe(NotificationType type, |
| 514 const NotificationSource& source, | 515 const NotificationSource& source, |
| 515 const NotificationDetails& details) { | 516 const NotificationDetails& details) { |
| 516 switch (type.value) { | 517 switch (type.value) { |
| 517 case NotificationType::PROFILE_CACHED_INFO_CHANGED: | 518 case chrome::PROFILE_CACHED_INFO_CHANGED: |
| 518 UpdateAvatarInfo(); | 519 UpdateAvatarInfo(); |
| 519 LayoutAvatar(); | 520 LayoutAvatar(); |
| 520 break; | 521 break; |
| 521 default: | 522 default: |
| 522 NOTREACHED() << "Got a notification we didn't register for!"; | 523 NOTREACHED() << "Got a notification we didn't register for!"; |
| 523 break; | 524 break; |
| 524 } | 525 } |
| 526 >>>>>>> .r91766 |
| 525 } | 527 } |
| 526 | 528 |
| 527 /////////////////////////////////////////////////////////////////////////////// | 529 /////////////////////////////////////////////////////////////////////////////// |
| 528 // OpaqueBrowserFrameView, private: | 530 // OpaqueBrowserFrameView, private: |
| 529 | 531 |
| 530 int OpaqueBrowserFrameView::FrameBorderThickness(bool restored) const { | 532 int OpaqueBrowserFrameView::FrameBorderThickness(bool restored) const { |
| 531 return (!restored && (frame_->IsMaximized() || frame_->IsFullscreen())) ? | 533 return (!restored && (frame_->IsMaximized() || frame_->IsFullscreen())) ? |
| 532 0 : kFrameBorderThickness; | 534 0 : kFrameBorderThickness; |
| 533 } | 535 } |
| 534 | 536 |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 g_browser_process->profile_manager()->GetProfileInfoCache(); | 1164 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 1163 Profile* profile = browser_view_->browser()->profile(); | 1165 Profile* profile = browser_view_->browser()->profile(); |
| 1164 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 1166 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
| 1165 if (index != std::string::npos) { | 1167 if (index != std::string::npos) { |
| 1166 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); | 1168 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); |
| 1167 avatar_button_->SetText(UTF16ToWideHack( | 1169 avatar_button_->SetText(UTF16ToWideHack( |
| 1168 cache.GetNameOfProfileAtIndex(index))); | 1170 cache.GetNameOfProfileAtIndex(index))); |
| 1169 } | 1171 } |
| 1170 } | 1172 } |
| 1171 } | 1173 } |
| OLD | NEW |