OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/ash_switches.h" | |
10 #include "ash/frame/caption_buttons/frame_caption_button.h" | 9 #include "ash/frame/caption_buttons/frame_caption_button.h" |
11 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
12 #include "ash/frame/default_header_painter.h" | 11 #include "ash/frame/default_header_painter.h" |
13 #include "ash/frame/frame_border_hit_test_controller.h" | 12 #include "ash/frame/frame_border_hit_test_controller.h" |
14 #include "ash/frame/header_painter_util.h" | 13 #include "ash/frame/header_painter_util.h" |
15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
16 #include "base/command_line.h" | |
17 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/extensions/extension_util.h" |
18 #include "chrome/browser/themes/theme_properties.h" | 17 #include "chrome/browser/themes/theme_properties.h" |
19 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
21 #include "chrome/browser/ui/views/frame/browser_frame.h" | 20 #include "chrome/browser/ui/views/frame/browser_frame.h" |
22 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 21 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
23 #include "chrome/browser/ui/views/frame/browser_view.h" | 22 #include "chrome/browser/ui/views/frame/browser_view.h" |
24 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 23 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
25 #include "chrome/browser/ui/views/profiles/avatar_label.h" | 24 #include "chrome/browser/ui/views/profiles/avatar_label.h" |
26 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 25 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
27 #include "chrome/browser/ui/views/tab_icon_view.h" | 26 #include "chrome/browser/ui/views/tab_icon_view.h" |
28 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 27 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
29 #include "chrome/common/chrome_switches.h" | |
30 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
31 #include "grit/ash_resources.h" | 29 #include "grit/ash_resources.h" |
32 #include "grit/theme_resources.h" | 30 #include "grit/theme_resources.h" |
33 #include "ui/accessibility/ax_view_state.h" | 31 #include "ui/accessibility/ax_view_state.h" |
34 #include "ui/aura/client/aura_constants.h" | 32 #include "ui/aura/client/aura_constants.h" |
35 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
36 #include "ui/base/hit_test.h" | 34 #include "ui/base/hit_test.h" |
37 #include "ui/base/layout.h" | 35 #include "ui/base/layout.h" |
38 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
39 #include "ui/base/theme_provider.h" | 37 #include "ui/base/theme_provider.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { | 489 bool BrowserNonClientFrameViewAsh::UsePackagedAppHeaderStyle() const { |
492 // Use the packaged app style for apps that aren't using the newer WebApp | 490 // Use the packaged app style for apps that aren't using the newer WebApp |
493 // style. | 491 // style. |
494 return browser_view()->browser()->is_app() && !UseWebAppHeaderStyle(); | 492 return browser_view()->browser()->is_app() && !UseWebAppHeaderStyle(); |
495 } | 493 } |
496 | 494 |
497 bool BrowserNonClientFrameViewAsh::UseWebAppHeaderStyle() const { | 495 bool BrowserNonClientFrameViewAsh::UseWebAppHeaderStyle() const { |
498 // Use of the experimental WebApp header style is guarded with the | 496 // Use of the experimental WebApp header style is guarded with the |
499 // streamlined hosted app style. | 497 // streamlined hosted app style. |
500 return browser_view()->browser()->is_app() && | 498 return browser_view()->browser()->is_app() && |
501 CommandLine::ForCurrentProcess()->HasSwitch( | 499 extensions::util::IsStreamlinedHostedAppsEnabled(); |
502 switches::kEnableStreamlinedHostedApps); | |
503 } | 500 } |
504 | 501 |
505 void BrowserNonClientFrameViewAsh::LayoutAvatar() { | 502 void BrowserNonClientFrameViewAsh::LayoutAvatar() { |
506 DCHECK(avatar_button()); | 503 DCHECK(avatar_button()); |
507 #if !defined(OS_CHROMEOS) | 504 #if !defined(OS_CHROMEOS) |
508 // ChromeOS shows avatar on V1 app. | 505 // ChromeOS shows avatar on V1 app. |
509 DCHECK(browser_view()->IsTabStripVisible()); | 506 DCHECK(browser_view()->IsTabStripVisible()); |
510 #endif | 507 #endif |
511 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); | 508 gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon(); |
512 | 509 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), | 630 canvas->FillRect(gfx::Rect(0, caption_button_container_->bounds().bottom(), |
634 width(), kClientEdgeThickness), | 631 width(), kClientEdgeThickness), |
635 ThemeProperties::GetDefaultColor( | 632 ThemeProperties::GetDefaultColor( |
636 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); | 633 ThemeProperties::COLOR_TOOLBAR_SEPARATOR)); |
637 } | 634 } |
638 | 635 |
639 void BrowserNonClientFrameViewAsh::UpdateBackButtonState(bool enabled) { | 636 void BrowserNonClientFrameViewAsh::UpdateBackButtonState(bool enabled) { |
640 web_app_back_button_->SetState(enabled ? views::Button::STATE_NORMAL | 637 web_app_back_button_->SetState(enabled ? views::Button::STATE_NORMAL |
641 : views::Button::STATE_DISABLED); | 638 : views::Button::STATE_DISABLED); |
642 } | 639 } |
OLD | NEW |