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/glass_browser_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_info_cache.h" | 14 #include "chrome/browser/profiles/profile_info_cache.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/themes/theme_service.h" | 16 #include "chrome/browser/themes/theme_service.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_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
19 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/side_tab_strip.h" |
20 #include "chrome/browser/ui/views/tabs/tab.h" | 20 #include "chrome/browser/ui/views/tabs/tab.h" |
21 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 21 #include "chrome/browser/ui/views/tabs/tab_strip.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/common/notification_service.h" | 25 #include "content/common/notification_service.h" |
25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
26 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
27 #include "grit/theme_resources_standard.h" | 28 #include "grit/theme_resources_standard.h" |
28 #include "grit/ui_resources.h" | 29 #include "grit/ui_resources.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
31 #include "ui/base/theme_provider.h" | 32 #include "ui/base/theme_provider.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 throbber_frame_(0) { | 84 throbber_frame_(0) { |
84 if (browser_view_->ShouldShowWindowIcon()) | 85 if (browser_view_->ShouldShowWindowIcon()) |
85 InitThrobberIcons(); | 86 InitThrobberIcons(); |
86 | 87 |
87 if (browser_view_->ShouldShowAvatar()) { | 88 if (browser_view_->ShouldShowAvatar()) { |
88 avatar_button_.reset(new AvatarMenuButton( | 89 avatar_button_.reset(new AvatarMenuButton( |
89 browser_view_->browser(), !browser_view_->IsOffTheRecord())); | 90 browser_view_->browser(), !browser_view_->IsOffTheRecord())); |
90 AddChildView(avatar_button_.get()); | 91 AddChildView(avatar_button_.get()); |
91 UpdateAvatarInfo(); | 92 UpdateAvatarInfo(); |
92 if (!browser_view_->IsOffTheRecord()) { | 93 if (!browser_view_->IsOffTheRecord()) { |
93 registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, | 94 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED, |
94 NotificationService::AllSources()); | 95 NotificationService::AllSources()); |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 GlassBrowserFrameView::~GlassBrowserFrameView() { | 100 GlassBrowserFrameView::~GlassBrowserFrameView() { |
100 } | 101 } |
101 | 102 |
102 /////////////////////////////////////////////////////////////////////////////// | 103 /////////////////////////////////////////////////////////////////////////////// |
103 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: | 104 // GlassBrowserFrameView, BrowserNonClientFrameView implementation: |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 } | 507 } |
507 } | 508 } |
508 | 509 |
509 void GlassBrowserFrameView::DisplayNextThrobberFrame() { | 510 void GlassBrowserFrameView::DisplayNextThrobberFrame() { |
510 throbber_frame_ = (throbber_frame_ + 1) % kThrobberIconCount; | 511 throbber_frame_ = (throbber_frame_ + 1) % kThrobberIconCount; |
511 SendMessage(frame_->GetNativeWindow(), WM_SETICON, | 512 SendMessage(frame_->GetNativeWindow(), WM_SETICON, |
512 static_cast<WPARAM>(ICON_SMALL), | 513 static_cast<WPARAM>(ICON_SMALL), |
513 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); | 514 reinterpret_cast<LPARAM>(throbber_icons_[throbber_frame_])); |
514 } | 515 } |
515 | 516 |
516 void GlassBrowserFrameView::Observe(NotificationType type, | 517 void GlassBrowserFrameView::Observe(int type, |
517 const NotificationSource& source, | 518 const NotificationSource& source, |
518 const NotificationDetails& details) { | 519 const NotificationDetails& details) { |
519 switch (type.value) { | 520 switch (type) { |
520 case NotificationType::PROFILE_CACHED_INFO_CHANGED: | 521 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: |
521 UpdateAvatarInfo(); | 522 UpdateAvatarInfo(); |
522 LayoutAvatar(); | 523 LayoutAvatar(); |
523 break; | 524 break; |
524 default: | 525 default: |
525 NOTREACHED() << "Got a notification we didn't register for!"; | 526 NOTREACHED() << "Got a notification we didn't register for!"; |
526 break; | 527 break; |
527 } | 528 } |
528 } | 529 } |
529 | 530 |
530 // static | 531 // static |
(...skipping 16 matching lines...) Expand all Loading... |
547 ProfileInfoCache& cache = | 548 ProfileInfoCache& cache = |
548 g_browser_process->profile_manager()->GetProfileInfoCache(); | 549 g_browser_process->profile_manager()->GetProfileInfoCache(); |
549 Profile* profile = browser_view_->browser()->profile(); | 550 Profile* profile = browser_view_->browser()->profile(); |
550 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); | 551 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); |
551 if (index != std::string::npos) { | 552 if (index != std::string::npos) { |
552 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); | 553 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); |
553 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); | 554 avatar_button_->SetText(cache.GetNameOfProfileAtIndex(index)); |
554 } | 555 } |
555 } | 556 } |
556 } | 557 } |
OLD | NEW |