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

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

Issue 2851543002: Update avatar button to MD (part 1) (Closed)
Patch Set: Renamed NewAvatarButton->ThemedAvatarButton and MaterialDesignAvatarButton->Win10NativeAvatarButton… Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/browser_non_client_frame_view_mus.h" 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/profiles/profiles_state.h" 9 #include "chrome/browser/profiles/profiles_state.h"
10 #include "chrome/browser/themes/theme_properties.h" 10 #include "chrome/browser/themes/theme_properties.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return 5; 165 return 5;
166 } 166 }
167 167
168 void BrowserNonClientFrameViewMus::UpdateThrobber(bool running) { 168 void BrowserNonClientFrameViewMus::UpdateThrobber(bool running) {
169 if (window_icon_) 169 if (window_icon_)
170 window_icon_->Update(); 170 window_icon_->Update();
171 } 171 }
172 172
173 views::View* BrowserNonClientFrameViewMus::GetProfileSwitcherView() const { 173 views::View* BrowserNonClientFrameViewMus::GetProfileSwitcherView() const {
174 #if defined(FRAME_AVATAR_BUTTON) 174 #if defined(FRAME_AVATAR_BUTTON)
175 return profile_switcher_.view(); 175 return profile_switcher_.button();
176 #else 176 #else
177 return nullptr; 177 return nullptr;
178 #endif 178 #endif
179 } 179 }
180 180
181 void BrowserNonClientFrameViewMus::UpdateClientArea() { 181 void BrowserNonClientFrameViewMus::UpdateClientArea() {
182 std::vector<gfx::Rect> additional_client_area; 182 std::vector<gfx::Rect> additional_client_area;
183 int top_container_offset = 0; 183 int top_container_offset = 0;
184 ImmersiveModeController* immersive_mode_controller = 184 ImmersiveModeController* immersive_mode_controller =
185 browser_view()->immersive_mode_controller(); 185 browser_view()->immersive_mode_controller();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 gfx::Rect BrowserNonClientFrameViewMus::GetWindowBoundsForClientBounds( 243 gfx::Rect BrowserNonClientFrameViewMus::GetWindowBoundsForClientBounds(
244 const gfx::Rect& client_bounds) const { 244 const gfx::Rect& client_bounds) const {
245 return client_bounds; 245 return client_bounds;
246 } 246 }
247 247
248 int BrowserNonClientFrameViewMus::NonClientHitTest(const gfx::Point& point) { 248 int BrowserNonClientFrameViewMus::NonClientHitTest(const gfx::Point& point) {
249 // TODO(sky): figure out how this interaction should work. 249 // TODO(sky): figure out how this interaction should work.
250 int hit_test = HTCLIENT; 250 int hit_test = HTCLIENT;
251 251
252 #if defined(FRAME_AVATAR_BUTTON) 252 #if defined(FRAME_AVATAR_BUTTON)
253 if (hit_test == HTCAPTION && profile_switcher_.view() && 253 if (hit_test == HTCAPTION && profile_switcher_.button() &&
254 ConvertedHitTest(this, profile_switcher_.view(), point)) { 254 ConvertedHitTest(this, profile_switcher_.button(), point)) {
255 return HTCLIENT; 255 return HTCLIENT;
256 } 256 }
257 #endif 257 #endif
258 258
259 // When the window is restored we want a large click target above the tabs 259 // When the window is restored we want a large click target above the tabs
260 // to drag the window, so redirect clicks in the tab's shadow to caption. 260 // to drag the window, so redirect clicks in the tab's shadow to caption.
261 if (hit_test == HTCLIENT && 261 if (hit_test == HTCLIENT &&
262 !(frame()->IsMaximized() || frame()->IsFullscreen())) { 262 !(frame()->IsMaximized() || frame()->IsFullscreen())) {
263 // Convert point to client coordinates. 263 // Convert point to client coordinates.
264 gfx::Point client_point(point); 264 gfx::Point client_point(point);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 PaintToolbarBackground(canvas); 298 PaintToolbarBackground(canvas);
299 else if (!UsePackagedAppHeaderStyle()) 299 else if (!UsePackagedAppHeaderStyle())
300 PaintContentEdge(canvas); 300 PaintContentEdge(canvas);
301 } 301 }
302 302
303 void BrowserNonClientFrameViewMus::Layout() { 303 void BrowserNonClientFrameViewMus::Layout() {
304 if (profile_indicator_icon()) 304 if (profile_indicator_icon())
305 LayoutIncognitoButton(); 305 LayoutIncognitoButton();
306 306
307 #if defined(FRAME_AVATAR_BUTTON) 307 #if defined(FRAME_AVATAR_BUTTON)
308 if (profile_switcher_.view()) 308 if (profile_switcher_.button())
309 LayoutProfileSwitcher(); 309 LayoutProfileSwitcher();
310 #endif 310 #endif
311 311
312 BrowserNonClientFrameView::Layout(); 312 BrowserNonClientFrameView::Layout();
313 313
314 UpdateClientArea(); 314 UpdateClientArea();
315 } 315 }
316 316
317 const char* BrowserNonClientFrameViewMus::GetClassName() const { 317 const char* BrowserNonClientFrameViewMus::GetClassName() const {
318 return kViewClassName; 318 return kViewClassName;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 return avatar_right + kAvatarIconPadding + 401 return avatar_right + kAvatarIconPadding +
402 frame_values().normal_insets.left(); 402 frame_values().normal_insets.left();
403 } 403 }
404 404
405 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const { 405 int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
406 const int frame_right_insets = frame_values().normal_insets.right() + 406 const int frame_right_insets = frame_values().normal_insets.right() +
407 frame_values().max_title_bar_button_width; 407 frame_values().max_title_bar_button_width;
408 int right_inset = kTabstripRightSpacing + frame_right_insets; 408 int right_inset = kTabstripRightSpacing + frame_right_insets;
409 409
410 #if defined(FRAME_AVATAR_BUTTON) 410 #if defined(FRAME_AVATAR_BUTTON)
411 if (profile_switcher_.view()) { 411 if (profile_switcher_.button()) {
412 right_inset += kAvatarButtonOffset + 412 right_inset += kAvatarButtonOffset +
413 profile_switcher_.view()->GetPreferredSize().width(); 413 profile_switcher_.button()->GetPreferredSize().width();
414 } 414 }
415 #endif 415 #endif
416 416
417 return right_inset; 417 return right_inset;
418 } 418 }
419 419
420 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const { 420 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const {
421 // Use for non tabbed trusted source windows, e.g. Settings, as well as apps. 421 // Use for non tabbed trusted source windows, e.g. Settings, as well as apps.
422 const Browser* const browser = browser_view()->browser(); 422 const Browser* const browser = browser_view()->browser();
423 return (!browser->is_type_tabbed() && browser->is_trusted_source()) || 423 return (!browser->is_type_tabbed() && browser->is_trusted_source()) ||
(...skipping 13 matching lines...) Expand all
437 int avatar_height = incognito_icon.height(); 437 int avatar_height = incognito_icon.height();
438 438
439 gfx::Rect avatar_bounds(kAvatarIconPadding, avatar_y, incognito_icon.width(), 439 gfx::Rect avatar_bounds(kAvatarIconPadding, avatar_y, incognito_icon.width(),
440 avatar_height); 440 avatar_height);
441 profile_indicator_icon()->SetBoundsRect(avatar_bounds); 441 profile_indicator_icon()->SetBoundsRect(avatar_bounds);
442 profile_indicator_icon()->SetVisible(true); 442 profile_indicator_icon()->SetVisible(true);
443 } 443 }
444 444
445 void BrowserNonClientFrameViewMus::LayoutProfileSwitcher() { 445 void BrowserNonClientFrameViewMus::LayoutProfileSwitcher() {
446 #if defined(FRAME_AVATAR_BUTTON) 446 #if defined(FRAME_AVATAR_BUTTON)
447 gfx::Size button_size = profile_switcher_.view()->GetPreferredSize(); 447 gfx::Size button_size = profile_switcher_.button()->GetPreferredSize();
448 int button_x = width() - GetTabStripRightInset() + kAvatarButtonOffset; 448 int button_x = width() - GetTabStripRightInset() + kAvatarButtonOffset;
449 profile_switcher_.view()->SetBounds(button_x, 0, button_size.width(), 449 profile_switcher_.button()->SetBounds(button_x, 0, button_size.width(),
450 button_size.height()); 450 button_size.height());
451 #endif 451 #endif
452 } 452 }
453 453
454 bool BrowserNonClientFrameViewMus::ShouldPaint() const { 454 bool BrowserNonClientFrameViewMus::ShouldPaint() const {
455 if (!frame()->IsFullscreen()) 455 if (!frame()->IsFullscreen())
456 return true; 456 return true;
457 457
458 // We need to paint when the top-of-window views are revealed in immersive 458 // We need to paint when the top-of-window views are revealed in immersive
459 // fullscreen. 459 // fullscreen.
460 ImmersiveModeController* immersive_mode_controller = 460 ImmersiveModeController* immersive_mode_controller =
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 // TODO: move ash_layout_constants to ash/public/cpp. 517 // TODO: move ash_layout_constants to ash/public/cpp.
518 const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen(); 518 const bool restored = !frame()->IsMaximized() && !frame()->IsFullscreen();
519 return GetAshLayoutSize(restored 519 return GetAshLayoutSize(restored
520 ? AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON 520 ? AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON
521 : AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON) 521 : AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON)
522 .height(); 522 .height();
523 #else 523 #else
524 return views::WindowManagerFrameValues::instance().normal_insets.top(); 524 return views::WindowManagerFrameValues::instance().normal_insets.top();
525 #endif 525 #endif
526 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698