| 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_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
| 10 #include "ash/frame/default_header_painter.h" | 10 #include "ash/frame/default_header_painter.h" |
| 11 #include "ash/frame/frame_border_hit_test_controller.h" | 11 #include "ash/frame/frame_border_hit_test_controller.h" |
| 12 #include "ash/frame/header_painter_util.h" | 12 #include "ash/frame/header_painter_util.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "base/profiler/scoped_tracker.h" | 14 #include "base/profiler/scoped_tracker.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/extensions/extension_util.h" | 16 #include "chrome/browser/extensions/extension_util.h" |
| 17 #include "chrome/browser/profiles/profiles_state.h" | 17 #include "chrome/browser/profiles/profiles_state.h" |
| 18 #include "chrome/browser/themes/theme_properties.h" | 18 #include "chrome/browser/themes/theme_properties.h" |
| 19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_commands.h" | 20 #include "chrome/browser/ui/browser_commands.h" |
| 21 #include "chrome/browser/ui/views/frame/browser_frame.h" | 21 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 22 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 22 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 23 #include "chrome/browser/ui/views/frame/browser_view.h" | 23 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 24 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 24 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
| 25 #include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h" | 25 #include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h" |
| 26 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 26 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
| 27 #include "chrome/browser/ui/views/tab_icon_view.h" | 27 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 28 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 28 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 29 #include "chrome/browser/web_applications/web_app.h" |
| 29 #include "components/signin/core/common/profile_management_switches.h" | 30 #include "components/signin/core/common/profile_management_switches.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 32 #include "extensions/browser/extension_registry.h" |
| 31 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
| 32 #include "ui/accessibility/ax_view_state.h" | 34 #include "ui/accessibility/ax_view_state.h" |
| 33 #include "ui/aura/client/aura_constants.h" | 35 #include "ui/aura/client/aura_constants.h" |
| 34 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 35 #include "ui/base/hit_test.h" | 37 #include "ui/base/hit_test.h" |
| 36 #include "ui/base/layout.h" | 38 #include "ui/base/layout.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 39 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "ui/base/theme_provider.h" | 40 #include "ui/base/theme_provider.h" |
| 39 #include "ui/compositor/layer_animator.h" | 41 #include "ui/compositor/layer_animator.h" |
| 40 #include "ui/gfx/canvas.h" | 42 #include "ui/gfx/canvas.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { | 517 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const { |
| 516 ImmersiveModeController* immersive_controller = | 518 ImmersiveModeController* immersive_controller = |
| 517 browser_view()->immersive_mode_controller(); | 519 browser_view()->immersive_mode_controller(); |
| 518 return immersive_controller->IsEnabled() && | 520 return immersive_controller->IsEnabled() && |
| 519 !immersive_controller->IsRevealed() && | 521 !immersive_controller->IsRevealed() && |
| 520 browser_view()->IsTabStripVisible(); | 522 browser_view()->IsTabStripVisible(); |
| 521 } | 523 } |
| 522 | 524 |
| 523 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { | 525 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { |
| 524 // Use the packaged app style for apps that aren't using the newer WebApp | 526 // Use the packaged app style for apps that aren't using the newer WebApp |
| 525 // style. | 527 // style, and that aren't bookmark apps. |
| 526 return browser_view()->browser()->is_app() && !UseWebAppHeaderStyle(); | 528 if (!browser_view()->browser()->is_app() || UseWebAppHeaderStyle()) |
| 529 return false; |
| 530 |
| 531 const std::string extension_id = web_app::GetExtensionIdFromApplicationName( |
| 532 browser_view()->browser()->app_name()); |
| 533 const extensions::Extension* extension = |
| 534 extensions::ExtensionRegistry::Get(browser_view()->browser()->profile()) |
| 535 ->GetExtensionById(extension_id, |
| 536 extensions::ExtensionRegistry::EVERYTHING); |
| 537 return !extension || !extension->from_bookmark(); |
| 527 } | 538 } |
| 528 | 539 |
| 529 bool BrowserNonClientFrameViewAsh::UseWebAppHeaderStyle() const { | 540 bool BrowserNonClientFrameViewAsh::UseWebAppHeaderStyle() const { |
| 530 return browser_view()->browser()->SupportsWindowFeature( | 541 return browser_view()->browser()->SupportsWindowFeature( |
| 531 Browser::FEATURE_WEBAPPFRAME); | 542 Browser::FEATURE_WEBAPPFRAME); |
| 532 } | 543 } |
| 533 | 544 |
| 534 void BrowserNonClientFrameViewAsh::LayoutAvatar() { | 545 void BrowserNonClientFrameViewAsh::LayoutAvatar() { |
| 535 DCHECK(avatar_button()); | 546 DCHECK(avatar_button()); |
| 536 #if !defined(OS_CHROMEOS) | 547 #if !defined(OS_CHROMEOS) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 685 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 675 } | 686 } |
| 676 | 687 |
| 677 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { | 688 void BrowserNonClientFrameViewAsh::PaintContentEdge(gfx::Canvas* canvas) { |
| 678 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 689 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); |
| 679 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 690 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
| 680 width(), kClientEdgeThickness), | 691 width(), kClientEdgeThickness), |
| 681 ThemeProperties::GetDefaultColor( | 692 ThemeProperties::GetDefaultColor( |
| 682 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 693 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
| 683 } | 694 } |
| OLD | NEW |