| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(new StatusBubbleViews(this, contents_web_view_)); |
| 554 contents_web_view_->SetStatusBubble(status_bubble_.get()); | 555 contents_web_view_->SetStatusBubble(status_bubble_.get()); |
| 555 } | 556 } |
| 556 | 557 |
| 557 gfx::Rect BrowserView::GetToolbarBounds() const { | 558 gfx::Rect BrowserView::GetToolbarBounds() const { |
| 558 gfx::Rect toolbar_bounds(toolbar_->bounds()); | 559 gfx::Rect toolbar_bounds(toolbar_->bounds()); |
| 559 if (toolbar_bounds.IsEmpty()) | 560 if (toolbar_bounds.IsEmpty()) |
| 560 return toolbar_bounds; | 561 return toolbar_bounds; |
| 561 // The apparent toolbar edges are outside the "real" toolbar edges. | 562 // The apparent toolbar edges are outside the "real" toolbar edges. |
| 562 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); | 563 toolbar_bounds.Inset(-views::NonClientFrameView::kClientEdgeThickness, 0); |
| 563 return toolbar_bounds; | 564 return toolbar_bounds; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 608 } |
| 608 | 609 |
| 609 bool BrowserView::IsGuestSession() const { | 610 bool BrowserView::IsGuestSession() const { |
| 610 return browser_->profile()->IsGuestSession(); | 611 return browser_->profile()->IsGuestSession(); |
| 611 } | 612 } |
| 612 | 613 |
| 613 bool BrowserView::IsRegularOrGuestSession() const { | 614 bool BrowserView::IsRegularOrGuestSession() const { |
| 614 return profiles::IsRegularOrGuestSession(browser_.get()); | 615 return profiles::IsRegularOrGuestSession(browser_.get()); |
| 615 } | 616 } |
| 616 | 617 |
| 618 bool BrowserView::HasClientEdge() const { |
| 619 #if defined(OS_WIN) |
| 620 return base::win::GetVersion() < base::win::VERSION_WIN10 || |
| 621 !frame_->ShouldUseNativeFrame(); |
| 622 #else |
| 623 return true; |
| 624 #endif |
| 625 } |
| 626 |
| 617 bool BrowserView::GetAccelerator(int cmd_id, | 627 bool BrowserView::GetAccelerator(int cmd_id, |
| 618 ui::Accelerator* accelerator) const { | 628 ui::Accelerator* accelerator) const { |
| 619 // We retrieve the accelerator information for standard accelerators | 629 // We retrieve the accelerator information for standard accelerators |
| 620 // for cut, copy and paste. | 630 // for cut, copy and paste. |
| 621 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) | 631 if (chrome::GetStandardAcceleratorForCommandId(cmd_id, accelerator)) |
| 622 return true; | 632 return true; |
| 623 // Else, we retrieve the accelerator information from the accelerator table. | 633 // Else, we retrieve the accelerator information from the accelerator table. |
| 624 for (std::map<ui::Accelerator, int>::const_iterator it = | 634 for (std::map<ui::Accelerator, int>::const_iterator it = |
| 625 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { | 635 accelerator_table_.begin(); it != accelerator_table_.end(); ++it) { |
| 626 if (it->second == cmd_id) { | 636 if (it->second == cmd_id) { |
| (...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 } | 2672 } |
| 2663 | 2673 |
| 2664 extensions::ActiveTabPermissionGranter* | 2674 extensions::ActiveTabPermissionGranter* |
| 2665 BrowserView::GetActiveTabPermissionGranter() { | 2675 BrowserView::GetActiveTabPermissionGranter() { |
| 2666 content::WebContents* web_contents = GetActiveWebContents(); | 2676 content::WebContents* web_contents = GetActiveWebContents(); |
| 2667 if (!web_contents) | 2677 if (!web_contents) |
| 2668 return nullptr; | 2678 return nullptr; |
| 2669 return extensions::TabHelper::FromWebContents(web_contents) | 2679 return extensions::TabHelper::FromWebContents(web_contents) |
| 2670 ->active_tab_permission_granter(); | 2680 ->active_tab_permission_granter(); |
| 2671 } | 2681 } |
| OLD | NEW |