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

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: refactored based on comments Created 4 years, 4 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 #include "chrome/browser/ui/ash/ash_util.h" 161 #include "chrome/browser/ui/ash/ash_util.h"
162 #endif 162 #endif
163 163
164 #if defined(USE_AURA) 164 #if defined(USE_AURA)
165 #include "ui/aura/client/window_tree_client.h" 165 #include "ui/aura/client/window_tree_client.h"
166 #include "ui/aura/window.h" 166 #include "ui/aura/window.h"
167 #include "ui/aura/window_tree_host.h" 167 #include "ui/aura/window_tree_host.h"
168 #endif 168 #endif
169 169
170 #if defined(OS_WIN) 170 #if defined(OS_WIN)
171 #include "base/win/windows_version.h"
171 #include "chrome/browser/win/jumplist.h" 172 #include "chrome/browser/win/jumplist.h"
172 #include "ui/gfx/color_palette.h" 173 #include "ui/gfx/color_palette.h"
173 #include "ui/native_theme/native_theme_dark_win.h" 174 #include "ui/native_theme/native_theme_dark_win.h"
174 #include "ui/views/win/scoped_fullscreen_visibility.h" 175 #include "ui/views/win/scoped_fullscreen_visibility.h"
175 #endif 176 #endif
176 177
177 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN) 178 #if BUILDFLAG(ENABLE_ONE_CLICK_SIGNIN)
178 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h" 179 #include "chrome/browser/ui/sync/one_click_signin_links_delegate_impl.h"
179 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h" 180 #include "chrome/browser/ui/views/sync/one_click_signin_dialog_view.h"
180 #endif 181 #endif
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 const float scale = canvas->UndoDeviceScaleFactor(); 544 const float scale = canvas->UndoDeviceScaleFactor();
544 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 545 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
545 const float inset = rect.height() - 1; 546 const float inset = rect.height() - 1;
546 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset); 547 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset);
547 SkPaint paint; 548 SkPaint paint;
548 paint.setColor(color); 549 paint.setColor(color);
549 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 550 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
550 } 551 }
551 552
552 void BrowserView::InitStatusBubble() { 553 void BrowserView::InitStatusBubble() {
553 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); 554 status_bubble_.reset(
555 new StatusBubbleViews(contents_web_view_, HasClientEdge()));
554 contents_web_view_->SetStatusBubble(status_bubble_.get()); 556 contents_web_view_->SetStatusBubble(status_bubble_.get());
555 } 557 }
556 558
557 gfx::Rect BrowserView::GetToolbarBounds() const { 559 gfx::Rect BrowserView::GetToolbarBounds() const {
558 gfx::Rect toolbar_bounds(toolbar_->bounds()); 560 gfx::Rect toolbar_bounds(toolbar_->bounds());
559 if (toolbar_bounds.IsEmpty()) 561 if (toolbar_bounds.IsEmpty())
560 return toolbar_bounds; 562 return toolbar_bounds;
561 // The apparent toolbar edges are outside the "real" toolbar edges. 563 // The apparent toolbar edges are outside the "real" toolbar edges.
562 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); 564 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0);
563 return toolbar_bounds; 565 return toolbar_bounds;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 609 }
608 610
609 bool BrowserView::IsGuestSession() const { 611 bool BrowserView::IsGuestSession() const {
610 return browser_->profile()->IsGuestSession(); 612 return browser_->profile()->IsGuestSession();
611 } 613 }
612 614
613 bool BrowserView::IsRegularOrGuestSession() const { 615 bool BrowserView::IsRegularOrGuestSession() const {
614 return profiles::IsRegularOrGuestSession(browser_.get()); 616 return profiles::IsRegularOrGuestSession(browser_.get());
615 } 617 }
616 618
619 bool BrowserView::HasClientEdge() const {
620 #if defined(OS_WIN)
621 return base::win::GetVersion() < base::win::VERSION_WIN10 ||
622 !frame_->ShouldUseNativeFrame();
623 #else
624 return true;
625 #endif
626 }
627
617 bool BrowserView::GetAccelerator(int cmd_id, 628 bool BrowserView::GetAccelerator(int cmd_id,
618 ui::Accelerator* accelerator) const { 629 ui::Accelerator* accelerator) const {
619 // We retrieve the accelerator information for standard accelerators 630 // We retrieve the accelerator information for standard accelerators
620 // for cut, copy and paste. 631 // for cut, copy and paste.
621 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) 632 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator))
622 return true; 633 return true;
623 // Else, we retrieve the accelerator information from the accelerator table. 634 // Else, we retrieve the accelerator information from the accelerator table.
624 for (std::map<ui::Accelerator, int>::const_iterator it = 635 for (std::map<ui::Accelerator, int>::const_iterator it =
625 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { 636 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) {
626 if (it->second == cmd_id) { 637 if (it->second == cmd_id) {
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 } 2673 }
2663 2674
2664 extensions::ActiveTabPermissionGranter* 2675 extensions::ActiveTabPermissionGranter*
2665 BrowserView::GetActiveTabPermissionGranter() { 2676 BrowserView::GetActiveTabPermissionGranter() {
2666 content::WebContents* web_contents = GetActiveWebContents(); 2677 content::WebContents* web_contents = GetActiveWebContents();
2667 if (!web_contents) 2678 if (!web_contents)
2668 return nullptr; 2679 return nullptr;
2669 return extensions::TabHelper::FromWebContents(web_contents) 2680 return extensions::TabHelper::FromWebContents(web_contents)
2670 ->active_tab_permission_granter(); 2681 ->active_tab_permission_granter();
2671 } 2682 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698