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

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

Issue 1608843002: Start untangling the avatar switcher from BrowserNonClientFrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160119-MacViewsBrowser-Compile
Patch Set: rename, enum class Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/app/chrome_dll_resource.h" 11 #include "chrome/app/chrome_dll_resource.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/themes/theme_properties.h" 13 #include "chrome/browser/themes/theme_properties.h"
14 #include "chrome/browser/ui/layout_constants.h" 14 #include "chrome/browser/ui/layout_constants.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 15 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 16 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
17 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
18 #include "chrome/browser/ui/views/tabs/tab.h" 17 #include "chrome/browser/ui/views/tabs/tab.h"
19 #include "chrome/browser/ui/views/tabs/tab_strip.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip.h"
20 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 19 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
21 #include "components/signin/core/browser/signin_header_helper.h" 20 #include "components/signin/core/browser/signin_header_helper.h"
22 #include "components/signin/core/common/profile_management_switches.h" 21 #include "components/signin/core/common/profile_management_switches.h"
23 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
24 #include "skia/ext/image_operations.h" 23 #include "skia/ext/image_operations.h"
25 #include "ui/base/resource/material_design/material_design_controller.h" 24 #include "ui/base/resource/material_design/material_design_controller.h"
26 #include "ui/base/resource/resource_bundle_win.h" 25 #include "ui/base/resource/resource_bundle_win.h"
27 #include "ui/base/theme_provider.h" 26 #include "ui/base/theme_provider.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 void GlassBrowserFrameView::Layout() { 259 void GlassBrowserFrameView::Layout() {
261 if (browser_view()->IsRegularOrGuestSession()) 260 if (browser_view()->IsRegularOrGuestSession())
262 LayoutNewStyleAvatar(); 261 LayoutNewStyleAvatar();
263 LayoutIncognitoIcon(); 262 LayoutIncognitoIcon();
264 LayoutClientView(); 263 LayoutClientView();
265 } 264 }
266 265
267 /////////////////////////////////////////////////////////////////////////////// 266 ///////////////////////////////////////////////////////////////////////////////
268 // GlassBrowserFrameView, protected: 267 // GlassBrowserFrameView, protected:
269 268
270 // views::ButtonListener:
271 void GlassBrowserFrameView::ButtonPressed(views::Button* sender,
272 const ui::Event& event) {
273 if (sender == new_avatar_button()) {
274 BrowserWindow::AvatarBubbleMode mode =
275 BrowserWindow::AVATAR_BUBBLE_MODE_DEFAULT;
276 if ((event.IsMouseEvent() &&
277 static_cast<const ui::MouseEvent&>(event).IsRightMouseButton()) ||
278 (event.type() == ui::ET_GESTURE_LONG_PRESS)) {
279 mode = BrowserWindow::AVATAR_BUBBLE_MODE_FAST_USER_SWITCH;
280 }
281 browser_view()->ShowAvatarBubbleFromAvatarButton(
282 mode, signin::ManageAccountsParams(),
283 signin_metrics::AccessPoint::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN);
284 }
285 }
286
287 // BrowserNonClientFrameView: 269 // BrowserNonClientFrameView:
288 void GlassBrowserFrameView::UpdateNewAvatarButtonImpl() { 270 void GlassBrowserFrameView::UpdateNewAvatarButtonImpl() {
289 UpdateNewAvatarButton(this, NewAvatarButton::NATIVE_BUTTON); 271 UpdateNewAvatarButton(AvatarButtonStyle::NATIVE);
290 } 272 }
291 273
292 /////////////////////////////////////////////////////////////////////////////// 274 ///////////////////////////////////////////////////////////////////////////////
293 // GlassBrowserFrameView, private: 275 // GlassBrowserFrameView, private:
294 276
295 // views::NonClientFrameView: 277 // views::NonClientFrameView:
296 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target, 278 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target,
297 const gfx::Rect& rect) const { 279 const gfx::Rect& rect) const {
298 CHECK_EQ(target, this); 280 CHECK_EQ(target, this);
299 bool hit_incognito_icon = avatar_button() && 281 bool hit_incognito_icon = avatar_button() &&
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 static bool initialized = false; 665 static bool initialized = false;
684 if (!initialized) { 666 if (!initialized) {
685 for (int i = 0; i < kThrobberIconCount; ++i) { 667 for (int i = 0; i < kThrobberIconCount; ++i) {
686 throbber_icons_[i] = 668 throbber_icons_[i] =
687 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 669 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
688 DCHECK(throbber_icons_[i]); 670 DCHECK(throbber_icons_[i]);
689 } 671 }
690 initialized = true; 672 initialized = true;
691 } 673 }
692 } 674 }
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