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

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

Issue 1529703003: [EXPERIMENT] [MacViews] Enable and handle the profile switcher. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // If the browser isn't in normal mode, we haven't customized the frame, so 219 // If the browser isn't in normal mode, we haven't customized the frame, so
220 // Windows can figure this out. If the point isn't within our bounds, then 220 // Windows can figure this out. If the point isn't within our bounds, then
221 // it's in the native portion of the frame, so again Windows can figure it 221 // it's in the native portion of the frame, so again Windows can figure it
222 // out. 222 // out.
223 if (!browser_view()->IsBrowserTypeNormal() || !bounds().Contains(point)) 223 if (!browser_view()->IsBrowserTypeNormal() || !bounds().Contains(point))
224 return HTNOWHERE; 224 return HTNOWHERE;
225 225
226 // See if the point is within the incognito icon or the profile switcher menu. 226 // See if the point is within the incognito icon or the profile switcher menu.
227 if ((profile_indicator_icon() && 227 if ((profile_indicator_icon() &&
228 profile_indicator_icon()->GetMirroredBounds().Contains(point)) || 228 profile_indicator_icon()->GetMirroredBounds().Contains(point)) ||
229 (profile_switcher_.view() && 229 profile_switcher_.HitTest(point))
230 profile_switcher_.view()->GetMirroredBounds().Contains(point)))
231 return HTCLIENT; 230 return HTCLIENT;
232 231
233 int frame_component = frame()->client_view()->NonClientHitTest(point); 232 int frame_component = frame()->client_view()->NonClientHitTest(point);
234 233
235 // See if we're in the sysmenu region. We still have to check the tabstrip 234 // See if we're in the sysmenu region. We still have to check the tabstrip
236 // first so that clicks in a tab don't get treated as sysmenu clicks. 235 // first so that clicks in a tab don't get treated as sysmenu clicks.
237 int client_border_thickness = ClientBorderThickness(false); 236 int client_border_thickness = ClientBorderThickness(false);
238 gfx::Rect sys_menu_region(client_border_thickness, 237 gfx::Rect sys_menu_region(client_border_thickness,
239 display::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME), 238 display::win::GetSystemMetricsInDIP(SM_CYSIZEFRAME),
240 display::win::GetSystemMetricsInDIP(SM_CXSMICON), 239 display::win::GetSystemMetricsInDIP(SM_CXSMICON),
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 /////////////////////////////////////////////////////////////////////////////// 293 ///////////////////////////////////////////////////////////////////////////////
295 // GlassBrowserFrameView, private: 294 // GlassBrowserFrameView, private:
296 295
297 // views::NonClientFrameView: 296 // views::NonClientFrameView:
298 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target, 297 bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target,
299 const gfx::Rect& rect) const { 298 const gfx::Rect& rect) const {
300 CHECK_EQ(target, this); 299 CHECK_EQ(target, this);
301 bool hit_incognito_icon = 300 bool hit_incognito_icon =
302 profile_indicator_icon() && 301 profile_indicator_icon() &&
303 profile_indicator_icon()->GetMirroredBounds().Intersects(rect); 302 profile_indicator_icon()->GetMirroredBounds().Intersects(rect);
304 bool hit_profile_switcher_button = 303 return hit_incognito_icon || profile_switcher_.Intersects(rect) ||
305 profile_switcher_.view() &&
306 profile_switcher_.view()->GetMirroredBounds().Intersects(rect);
307 return hit_incognito_icon || hit_profile_switcher_button ||
308 !frame()->client_view()->bounds().Intersects(rect); 304 !frame()->client_view()->bounds().Intersects(rect);
309 } 305 }
310 306
311 int GlassBrowserFrameView::ClientBorderThickness(bool restored) const { 307 int GlassBrowserFrameView::ClientBorderThickness(bool restored) const {
312 if ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored) 308 if ((frame()->IsMaximized() || frame()->IsFullscreen()) && !restored)
313 return 0; 309 return 0;
314 310
315 return (base::win::GetVersion() < base::win::VERSION_WIN10) 311 return (base::win::GetVersion() < base::win::VERSION_WIN10)
316 ? kClientBorderThicknessPreWin10 312 ? kClientBorderThicknessPreWin10
317 : kClientBorderThicknessWin10; 313 : kClientBorderThicknessWin10;
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 static bool initialized = false; 673 static bool initialized = false;
678 if (!initialized) { 674 if (!initialized) {
679 for (int i = 0; i < kThrobberIconCount; ++i) { 675 for (int i = 0; i < kThrobberIconCount; ++i) {
680 throbber_icons_[i] = 676 throbber_icons_[i] =
681 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i); 677 ui::LoadThemeIconFromResourcesDataDLL(IDI_THROBBER_01 + i);
682 DCHECK(throbber_icons_[i]); 678 DCHECK(throbber_icons_[i]);
683 } 679 }
684 initialized = true; 680 initialized = true;
685 } 681 }
686 } 682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698