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

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

Issue 7045023: Simplify ProfileMenuButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 7 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/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"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 browser_view_(browser_view), 84 browser_view_(browser_view),
85 throbber_running_(false), 85 throbber_running_(false),
86 throbber_frame_(0) { 86 throbber_frame_(0) {
87 if (browser_view_->ShouldShowWindowIcon()) 87 if (browser_view_->ShouldShowWindowIcon())
88 InitThrobberIcons(); 88 InitThrobberIcons();
89 // If multi-profile is enabled set up profile button and login notifications. 89 // If multi-profile is enabled set up profile button and login notifications.
90 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 90 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
91 if (browser_command_line.HasSwitch(switches::kMultiProfiles) && 91 if (browser_command_line.HasSwitch(switches::kMultiProfiles) &&
92 !browser_view->ShouldShowOffTheRecordAvatar()) { 92 !browser_view->ShouldShowOffTheRecordAvatar()) {
93 RegisterLoginNotifications(); 93 RegisterLoginNotifications();
94 profile_button_.reset(new ProfileMenuButton(NULL, std::wstring(), 94 profile_button_.reset(new ProfileMenuButton(std::wstring(),
95 this, browser_view_->browser()->profile())); 95 browser_view_->browser()->profile()));
96 profile_button_->SetVisible(false); 96 profile_button_->SetVisible(false);
97 profile_tag_.reset(new ProfileTagView(frame_, profile_button_.get())); 97 profile_tag_.reset(new ProfileTagView(frame_, profile_button_.get()));
98 profile_tag_->SetVisible(false); 98 profile_tag_->SetVisible(false);
99 AddChildView(profile_tag_.get()); 99 AddChildView(profile_tag_.get());
100 AddChildView(profile_button_.get()); 100 AddChildView(profile_button_.get());
101 } 101 }
102 } 102 }
103 103
104 GlassBrowserFrameView::~GlassBrowserFrameView() { 104 GlassBrowserFrameView::~GlassBrowserFrameView() {
105 } 105 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 int frame_border_thickness = FrameBorderThickness(); 218 int frame_border_thickness = FrameBorderThickness();
219 int window_component = GetHTComponentForFrame(point, frame_border_thickness, 219 int window_component = GetHTComponentForFrame(point, frame_border_thickness,
220 nonclient_border_thickness, frame_border_thickness, 220 nonclient_border_thickness, frame_border_thickness,
221 kResizeAreaCornerSize - frame_border_thickness, 221 kResizeAreaCornerSize - frame_border_thickness,
222 frame_->window_delegate()->CanResize()); 222 frame_->window_delegate()->CanResize());
223 // Fall back to the caption if no other component matches. 223 // Fall back to the caption if no other component matches.
224 return (window_component == HTNOWHERE) ? HTCAPTION : window_component; 224 return (window_component == HTNOWHERE) ? HTCAPTION : window_component;
225 } 225 }
226 226
227 /////////////////////////////////////////////////////////////////////////////// 227 ///////////////////////////////////////////////////////////////////////////////
228 // GlassBrowserFrameView, views::ViewMenuDelegate implementation:
229 void GlassBrowserFrameView::RunMenu(views::View *source, const gfx::Point &pt) {
230 profile_button_->RunMenuAt(pt);
231 }
232
233 ///////////////////////////////////////////////////////////////////////////////
234 // GlassBrowserFrameView, views::View overrides: 228 // GlassBrowserFrameView, views::View overrides:
235 229
236 void GlassBrowserFrameView::OnPaint(gfx::Canvas* canvas) { 230 void GlassBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
237 if (!browser_view_->IsTabStripVisible()) 231 if (!browser_view_->IsTabStripVisible())
238 return; // Nothing is visible, so don't bother to paint. 232 return; // Nothing is visible, so don't bother to paint.
239 233
240 PaintToolbarBackground(canvas); 234 PaintToolbarBackground(canvas);
241 if (browser_view_->ShouldShowOffTheRecordAvatar()) 235 if (browser_view_->ShouldShowOffTheRecordAvatar())
242 PaintOTRAvatar(canvas); 236 PaintOTRAvatar(canvas);
243 if (!frame_->IsMaximized()) 237 if (!frame_->IsMaximized())
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 static bool initialized = false; 609 static bool initialized = false;
616 if (!initialized) { 610 if (!initialized) {
617 ResourceBundle &rb = ResourceBundle::GetSharedInstance(); 611 ResourceBundle &rb = ResourceBundle::GetSharedInstance();
618 for (int i = 0; i < kThrobberIconCount; ++i) { 612 for (int i = 0; i < kThrobberIconCount; ++i) {
619 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i); 613 throbber_icons_[i] = rb.LoadThemeIcon(IDI_THROBBER_01 + i);
620 DCHECK(throbber_icons_[i]); 614 DCHECK(throbber_icons_[i]);
621 } 615 }
622 initialized = true; 616 initialized = true;
623 } 617 }
624 } 618 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.h ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698