OLD | NEW |
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 Loading... |
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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 const float scale = canvas->UndoDeviceScaleFactor(); | 538 const float scale = canvas->UndoDeviceScaleFactor(); |
538 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); | 539 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); |
539 const float inset = rect.height() - 1; | 540 const float inset = rect.height() - 1; |
540 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset); | 541 rect.Inset(0, at_bottom ? inset : 0, 0, at_bottom ? 0 : inset); |
541 SkPaint paint; | 542 SkPaint paint; |
542 paint.setColor(color); | 543 paint.setColor(color); |
543 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); | 544 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); |
544 } | 545 } |
545 | 546 |
546 void BrowserView::InitStatusBubble() { | 547 void BrowserView::InitStatusBubble() { |
547 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); | 548 status_bubble_.reset( |
| 549 new StatusBubbleViews(contents_web_view_, HasClientEdge())); |
548 contents_web_view_->SetStatusBubble(status_bubble_.get()); | 550 contents_web_view_->SetStatusBubble(status_bubble_.get()); |
549 } | 551 } |
550 | 552 |
551 gfx::Rect BrowserView::GetToolbarBounds() const { | 553 gfx::Rect BrowserView::GetToolbarBounds() const { |
552 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 554 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
553 if (toolbar_bounds.IsEmpty()) | 555 if (toolbar_bounds.IsEmpty()) |
554 return toolbar_bounds; | 556 return toolbar_bounds; |
555 // The apparent toolbar edges are outside the "real" toolbar edges. | 557 // The apparent toolbar edges are outside the "real" toolbar edges. |
556 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 558 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
557 return toolbar_bounds; | 559 return toolbar_bounds; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } | 603 } |
602 | 604 |
603 bool BrowserView::IsGuestSession() const { | 605 bool BrowserView::IsGuestSession() const { |
604 return browser_->profile()->IsGuestSession(); | 606 return browser_->profile()->IsGuestSession(); |
605 } | 607 } |
606 | 608 |
607 bool BrowserView::IsRegularOrGuestSession() const { | 609 bool BrowserView::IsRegularOrGuestSession() const { |
608 return profiles::IsRegularOrGuestSession(browser_.get()); | 610 return profiles::IsRegularOrGuestSession(browser_.get()); |
609 } | 611 } |
610 | 612 |
| 613 bool BrowserView::HasClientEdge() const { |
| 614 #if defined(OS_WIN) |
| 615 return base::win::GetVersion() < base::win::VERSION_WIN10 || |
| 616 !frame_->ShouldUseNativeFrame(); |
| 617 #else |
| 618 return true; |
| 619 #endif |
| 620 } |
| 621 |
611 bool BrowserView::GetAccelerator(int cmd_id, | 622 bool BrowserView::GetAccelerator(int cmd_id, |
612 ui::Accelerator* accelerator) const { | 623 ui::Accelerator* accelerator) const { |
613 // We retrieve the accelerator information for standard accelerators | 624 // We retrieve the accelerator information for standard accelerators |
614 // for cut, copy and paste. | 625 // for cut, copy and paste. |
615 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) | 626 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) |
616 return true; | 627 return true; |
617 // Else, we retrieve the accelerator information from the accelerator table. | 628 // Else, we retrieve the accelerator information from the accelerator table. |
618 for (std::map<ui::Accelerator, int>::const_iterator it = | 629 for (std::map<ui::Accelerator, int>::const_iterator it = |
619 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { | 630 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { |
620 if (it->second == cmd_id) { | 631 if (it->second == cmd_id) { |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 } | 2667 } |
2657 | 2668 |
2658 extensions::ActiveTabPermissionGranter* | 2669 extensions::ActiveTabPermissionGranter* |
2659 BrowserView::GetActiveTabPermissionGranter() { | 2670 BrowserView::GetActiveTabPermissionGranter() { |
2660 content::WebContents* web_contents = GetActiveWebContents(); | 2671 content::WebContents* web_contents = GetActiveWebContents(); |
2661 if (!web_contents) | 2672 if (!web_contents) |
2662 return nullptr; | 2673 return nullptr; |
2663 return extensions::TabHelper::FromWebContents(web_contents) | 2674 return extensions::TabHelper::FromWebContents(web_contents) |
2664 ->active_tab_permission_granter(); | 2675 ->active_tab_permission_granter(); |
2665 } | 2676 } |
OLD | NEW |