| OLD | NEW |
| 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 "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 content::WebContents* current_tab = browser_view()->GetActiveWebContents(); | 357 content::WebContents* current_tab = browser_view()->GetActiveWebContents(); |
| 358 return current_tab ? current_tab->IsLoading() : false; | 358 return current_tab ? current_tab->IsLoading() : false; |
| 359 } | 359 } |
| 360 | 360 |
| 361 gfx::ImageSkia BrowserNonClientFrameViewMus::GetFaviconForTabIconView() { | 361 gfx::ImageSkia BrowserNonClientFrameViewMus::GetFaviconForTabIconView() { |
| 362 views::WidgetDelegate* delegate = frame()->widget_delegate(); | 362 views::WidgetDelegate* delegate = frame()->widget_delegate(); |
| 363 if (!delegate) | 363 if (!delegate) |
| 364 return gfx::ImageSkia(); | 364 return gfx::ImageSkia(); |
| 365 return delegate->GetWindowIcon(); | 365 return delegate->GetWindowIcon(); |
| 366 } | 366 } |
| 367 | |
| 368 /////////////////////////////////////////////////////////////////////////////// | |
| 369 // views::ButtonListener: | |
| 370 | |
| 371 void BrowserNonClientFrameViewMus::ButtonPressed(views::Button* sender, | |
| 372 const ui::Event& event) { | |
| 373 #if !defined(FRAME_AVATAR_BUTTON) | |
| 374 NOTREACHED(); | |
| 375 #else | |
| 376 DCHECK(sender == new_avatar_button()); | |
| 377 int command = IDC_SHOW_AVATAR_MENU; | |
| 378 if (event.IsMouseEvent() && | |
| 379 static_cast<const ui::MouseEvent&>(event).IsRightMouseButton()) { | |
| 380 command = IDC_SHOW_FAST_USER_SWITCHER; | |
| 381 } | |
| 382 chrome::ExecuteCommand(browser_view()->browser(), command); | |
| 383 #endif | |
| 384 } | |
| 385 | |
| 386 /////////////////////////////////////////////////////////////////////////////// | 367 /////////////////////////////////////////////////////////////////////////////// |
| 387 // BrowserNonClientFrameViewMus, protected: | 368 // BrowserNonClientFrameViewMus, protected: |
| 388 | 369 |
| 389 // BrowserNonClientFrameView: | 370 // BrowserNonClientFrameView: |
| 390 void BrowserNonClientFrameViewMus::UpdateNewAvatarButtonImpl() { | 371 void BrowserNonClientFrameViewMus::UpdateNewAvatarButtonImpl() { |
| 391 #if defined(FRAME_AVATAR_BUTTON) | 372 #if defined(FRAME_AVATAR_BUTTON) |
| 392 UpdateNewAvatarButton(this, NewAvatarButton::NATIVE_BUTTON); | 373 UpdateNewAvatarButton(AvatarButtonStyle::NATIVE); |
| 393 #endif | 374 #endif |
| 394 } | 375 } |
| 395 | 376 |
| 396 /////////////////////////////////////////////////////////////////////////////// | 377 /////////////////////////////////////////////////////////////////////////////// |
| 397 // BrowserNonClientFrameViewMus, private: | 378 // BrowserNonClientFrameViewMus, private: |
| 398 | 379 |
| 399 mus::Window* BrowserNonClientFrameViewMus::mus_window() { | 380 mus::Window* BrowserNonClientFrameViewMus::mus_window() { |
| 400 return static_cast<BrowserFrameMus*>(frame()->native_widget())->window(); | 381 return static_cast<BrowserFrameMus*>(frame()->native_widget())->window(); |
| 401 } | 382 } |
| 402 | 383 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 } | 643 } |
| 663 | 644 |
| 664 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { | 645 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
| 665 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 646 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 666 const int bottom = frame_values().normal_insets.bottom(); | 647 const int bottom = frame_values().normal_insets.bottom(); |
| 667 canvas->FillRect( | 648 canvas->FillRect( |
| 668 gfx::Rect(0, bottom, width(), kClientEdgeThickness), | 649 gfx::Rect(0, bottom, width(), kClientEdgeThickness), |
| 669 GetThemeProvider()->GetColor( | 650 GetThemeProvider()->GetColor( |
| 670 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 651 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
| 671 } | 652 } |
| OLD | NEW |