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/views/avatar_menu_button.h" | 16 #include "chrome/browser/ui/views/avatar_menu_button.h" |
17 #include "chrome/browser/ui/views/frame/browser_frame.h" | 17 #include "chrome/browser/ui/views/frame/browser_frame.h" |
18 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
19 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
20 #include "chrome/browser/ui/views/toolbar_view.h" | 20 #include "chrome/browser/ui/views/toolbar_view.h" |
| 21 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
23 #include "content/browser/tab_contents/tab_contents.h" | 24 #include "content/browser/tab_contents/tab_contents.h" |
24 #include "content/common/notification_service.h" | 25 #include "content/common/notification_service.h" |
25 #include "grit/chromium_strings.h" | 26 #include "grit/chromium_strings.h" |
26 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
27 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
28 #include "grit/theme_resources_standard.h" | 29 #include "grit/theme_resources_standard.h" |
29 #include "grit/ui_resources.h" | 30 #include "grit/ui_resources.h" |
30 #include "ui/base/accessibility/accessible_view_state.h" | 31 #include "ui/base/accessibility/accessible_view_state.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 AddChildView(window_icon_); | 200 AddChildView(window_icon_); |
200 window_icon_->Update(); | 201 window_icon_->Update(); |
201 } | 202 } |
202 | 203 |
203 if (browser_view_->ShouldShowAvatar()) { | 204 if (browser_view_->ShouldShowAvatar()) { |
204 avatar_button_.reset(new AvatarMenuButton( | 205 avatar_button_.reset(new AvatarMenuButton( |
205 browser_view_->browser(), !browser_view_->IsOffTheRecord())); | 206 browser_view_->browser(), !browser_view_->IsOffTheRecord())); |
206 AddChildView(avatar_button_.get()); | 207 AddChildView(avatar_button_.get()); |
207 UpdateAvatarInfo(); | 208 UpdateAvatarInfo(); |
208 if (!browser_view_->IsOffTheRecord()) { | 209 if (!browser_view_->IsOffTheRecord()) { |
209 registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, | 210 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
210 NotificationService::AllSources()); | 211 NotificationService::AllSources()); |
211 } | 212 } |
212 } | 213 } |
213 } | 214 } |
214 | 215 |
215 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { | 216 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { |
216 } | 217 } |
217 | 218 |
218 /////////////////////////////////////////////////////////////////////////////// | 219 /////////////////////////////////////////////////////////////////////////////// |
219 // OpaqueBrowserFrameView, protected: | 220 // OpaqueBrowserFrameView, protected: |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 if (!delegate) { | 501 if (!delegate) { |
501 LOG(WARNING) << "delegate is NULL, returning safe default."; | 502 LOG(WARNING) << "delegate is NULL, returning safe default."; |
502 return SkBitmap(); | 503 return SkBitmap(); |
503 } | 504 } |
504 return delegate->GetWindowIcon(); | 505 return delegate->GetWindowIcon(); |
505 } | 506 } |
506 | 507 |
507 /////////////////////////////////////////////////////////////////////////////// | 508 /////////////////////////////////////////////////////////////////////////////// |
508 // OpaqueBrowserFrameView, protected: | 509 // OpaqueBrowserFrameView, protected: |
509 | 510 |
510 void OpaqueBrowserFrameView::Observe(NotificationType type, | 511 void OpaqueBrowserFrameView::Observe(int type, |
511 const NotificationSource& source, | 512 const NotificationSource& source, |
512 const NotificationDetails& details) { | 513 const NotificationDetails& details) { |
513 switch (type.value) { | 514 switch (type) { |
514 case NotificationType::PROFILE_CACHED_INFO_CHANGED: | 515 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: |
515 UpdateAvatarInfo(); | 516 UpdateAvatarInfo(); |
516 LayoutAvatar(); | 517 LayoutAvatar(); |
517 break; | 518 break; |
518 default: | 519 default: |
519 NOTREACHED() << "Got a notification we didn't register for!"; | 520 NOTREACHED() << "Got a notification we didn't register for!"; |
520 break; | 521 break; |
521 } | 522 } |
522 } | 523 } |
523 | 524 |
524 /////////////////////////////////////////////////////////////////////////////// | 525 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 g_browser_process->profile_manager()->GetProfileInfoCache(); | 1160 g_browser_process->profile_manager()->GetProfileInfoCache(); |
1160 Profile* profile = browser_view_->browser()->profile(); | 1161 Profile* profile = browser_view_->browser()->profile(); |
1161 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 1162 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
1162 if (index != std::string::npos) { | 1163 if (index != std::string::npos) { |
1163 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); | 1164 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); |
1164 avatar_button_->SetText(UTF16ToWideHack( | 1165 avatar_button_->SetText(UTF16ToWideHack( |
1165 cache.GetNameOfProfileAtIndex(index))); | 1166 cache.GetNameOfProfileAtIndex(index))); |
1166 } | 1167 } |
1167 } | 1168 } |
1168 } | 1169 } |
OLD | NEW |