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

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

Issue 2247563002: Change status bubble rendering at hidpi and when there is no client edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments and nits Created 4 years, 3 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 #include "chrome/browser/ui/ash/ash_util.h" 160 #include "chrome/browser/ui/ash/ash_util.h"
161 #endif 161 #endif
162 162
163 #if defined(USE_AURA) 163 #if defined(USE_AURA)
164 #include "ui/aura/client/window_tree_client.h" 164 #include "ui/aura/client/window_tree_client.h"
165 #include "ui/aura/window.h" 165 #include "ui/aura/window.h"
166 #include "ui/aura/window_tree_host.h" 166 #include "ui/aura/window_tree_host.h"
167 #endif 167 #endif
168 168
169 #if defined(OS_WIN) 169 #if defined(OS_WIN)
170 #include "base/win/windows_version.h"
170 #include "chrome/browser/win/jumplist.h" 171 #include "chrome/browser/win/jumplist.h"
171 #include "ui/gfx/color_palette.h" 172 #include "ui/gfx/color_palette.h"
172 #include "ui/native_theme/native_theme_dark_win.h" 173 #include "ui/native_theme/native_theme_dark_win.h"
173 #include "ui/views/win/scoped_fullscreen_visibility.h" 174 #include "ui/views/win/scoped_fullscreen_visibility.h"
174 #endif 175 #endif
175 176
176 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) 177 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN)
177 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" 178 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h"
178 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" 179 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h"
179 #endif 180 #endif
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 const float scale = canvas->UndoDeviceScaleFactor(); 537 const float scale = canvas->UndoDeviceScaleFactor();
537 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 538 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
538 const float inset = rect.height() - 1; 539 const float inset = rect.height() - 1;
539 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset); 540 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset);
540 SkPaint paint; 541 SkPaint paint;
541 paint.setColor(color); 542 paint.setColor(color);
542 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 543 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
543 } 544 }
544 545
545 void BrowserView::InitStatusBubble() { 546 void BrowserView::InitStatusBubble() {
546 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); 547 status_bubble_.reset(
548 new StatusBubbleViews(contents_web_view_, HasClientEdge()));
547 contents_web_view_->SetStatusBubble(status_bubble_.get()); 549 contents_web_view_->SetStatusBubble(status_bubble_.get());
548 } 550 }
549 551
550 gfx::Rect BrowserView::GetToolbarBounds() const { 552 gfx::Rect BrowserView::GetToolbarBounds() const {
551 gfx::Rect toolbar_bounds(toolbar_->bounds()); 553 gfx::Rect toolbar_bounds(toolbar_->bounds());
552 if (toolbar_bounds.IsEmpty()) 554 if (toolbar_bounds.IsEmpty())
553 return toolbar_bounds; 555 return toolbar_bounds;
554 // The apparent toolbar edges are outside the "real" toolbar edges. 556 // The apparent toolbar edges are outside the "real" toolbar edges.
555 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); 557 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
556 return toolbar_bounds; 558 return toolbar_bounds;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 602 }
601 603
602 bool BrowserView::IsGuestSession() const { 604 bool BrowserView::IsGuestSession() const {
603 return browser_->profile()->IsGuestSession(); 605 return browser_->profile()->IsGuestSession();
604 } 606 }
605 607
606 bool BrowserView::IsRegularOrGuestSession() const { 608 bool BrowserView::IsRegularOrGuestSession() const {
607 return profiles::IsRegularOrGuestSession(browser_.get()); 609 return profiles::IsRegularOrGuestSession(browser_.get());
608 } 610 }
609 611
612 bool BrowserView::HasClientEdge() const {
613 #if defined(OS_WIN)
614 return base::win::GetVersion() < base::win::VERSION_WIN10 ||
615 !frame_->ShouldUseNativeFrame();
616 #else
617 return true;
618 #endif
619 }
620
610 bool BrowserView::GetAccelerator(int cmd_id, 621 bool BrowserView::GetAccelerator(int cmd_id,
611 ui::Accelerator* accelerator) const { 622 ui::Accelerator* accelerator) const {
612 // We retrieve the accelerator information for standard accelerators 623 // We retrieve the accelerator information for standard accelerators
613 // for cut, copy and paste. 624 // for cut, copy and paste.
614 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) 625 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator))
615 return true; 626 return true;
616 // Else, we retrieve the accelerator information from the accelerator table. 627 // Else, we retrieve the accelerator information from the accelerator table.
617 for (std::map<ui::Accelerator, int>::const_iterator it = 628 for (std::map<ui::Accelerator, int>::const_iterator it =
618 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { 629 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) {
619 if (it->second == cmd_id) { 630 if (it->second == cmd_id) {
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2655 } 2666 }
2656 2667
2657 extensions::ActiveTabPermissionGranter* 2668 extensions::ActiveTabPermissionGranter*
2658 BrowserView::GetActiveTabPermissionGranter() { 2669 BrowserView::GetActiveTabPermissionGranter() {
2659 content::WebContents* web_contents = GetActiveWebContents(); 2670 content::WebContents* web_contents = GetActiveWebContents();
2660 if (!web_contents) 2671 if (!web_contents)
2661 return nullptr; 2672 return nullptr;
2662 return extensions::TabHelper::FromWebContents(web_contents) 2673 return extensions::TabHelper::FromWebContents(web_contents)
2663 ->active_tab_permission_granter(); 2674 ->active_tab_permission_granter();
2664 } 2675 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698