Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1223)

Side by Side Diff: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 if (browser_view_->ShouldShowAvatar()) { 205 if (browser_view_->ShouldShowAvatar()) {
205 ui::MenuModel* menu_model = browser_view_->IsOffTheRecord() ? 206 ui::MenuModel* menu_model = browser_view_->IsOffTheRecord() ?
206 NULL : new ProfileMenuModel(browser_view_->browser()); 207 NULL : new ProfileMenuModel(browser_view_->browser());
207 // AvatarMenuButton takes ownership of |menu_model|. 208 // AvatarMenuButton takes ownership of |menu_model|.
208 avatar_button_.reset(new AvatarMenuButton(std::wstring(), menu_model)); 209 avatar_button_.reset(new AvatarMenuButton(std::wstring(), menu_model));
209 AddChildView(avatar_button_.get()); 210 AddChildView(avatar_button_.get());
210 UpdateAvatarInfo(); 211 UpdateAvatarInfo();
211 if (!browser_view_->IsOffTheRecord()) { 212 if (!browser_view_->IsOffTheRecord()) {
212 registrar_.Add(this, NotificationType::PROFILE_CACHED_INFO_CHANGED, 213 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED,
213 NotificationService::AllSources()); 214 NotificationService::AllSources());
214 } 215 }
215 } 216 }
216 } 217 }
217 218
218 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() { 219 OpaqueBrowserFrameView::~OpaqueBrowserFrameView() {
219 } 220 }
220 221
221 /////////////////////////////////////////////////////////////////////////////// 222 ///////////////////////////////////////////////////////////////////////////////
222 // OpaqueBrowserFrameView, protected: 223 // OpaqueBrowserFrameView, protected:
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if (!delegate) { 504 if (!delegate) {
504 LOG(WARNING) << "delegate is NULL, returning safe default."; 505 LOG(WARNING) << "delegate is NULL, returning safe default.";
505 return SkBitmap(); 506 return SkBitmap();
506 } 507 }
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(int type,
514 const NotificationSource& source, 515 const NotificationSource& source,
515 const NotificationDetails& details) { 516 const NotificationDetails& details) {
516 switch (type.value) { 517 switch (type) {
517 case NotificationType::PROFILE_CACHED_INFO_CHANGED: 518 case chrome::NOTIFICATION_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 }
525 } 526 }
526 527
527 /////////////////////////////////////////////////////////////////////////////// 528 ///////////////////////////////////////////////////////////////////////////////
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 g_browser_process->profile_manager()->GetProfileInfoCache(); 1163 g_browser_process->profile_manager()->GetProfileInfoCache();
1163 Profile* profile = browser_view_->browser()->profile(); 1164 Profile* profile = browser_view_->browser()->profile();
1164 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath()); 1165 size_t index = cache.GetIndexOfProfileWithPath(profile->GetPath());
1165 if (index != std::string::npos) { 1166 if (index != std::string::npos) {
1166 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index)); 1167 avatar_button_->SetIcon(cache.GetAvatarIconOfProfileAtIndex(index));
1167 avatar_button_->SetText(UTF16ToWideHack( 1168 avatar_button_->SetText(UTF16ToWideHack(
1168 cache.GetNameOfProfileAtIndex(index))); 1169 cache.GetNameOfProfileAtIndex(index)));
1169 } 1170 }
1170 } 1171 }
1171 } 1172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698