OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_mus.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/browser/profiles/profiles_state.h" | 9 #include "chrome/browser/profiles/profiles_state.h" |
10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/layout_constants.h" | 12 #include "chrome/browser/ui/layout_constants.h" |
13 #include "chrome/browser/ui/views/frame/browser_frame.h" | 13 #include "chrome/browser/ui/views/frame/browser_frame.h" |
14 #include "chrome/browser/ui/views/frame/browser_frame_mus.h" | 14 #include "chrome/browser/ui/views/frame/browser_frame_mus.h" |
15 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 15 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 17 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
18 #include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h" | |
19 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" | 18 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h" |
20 #include "chrome/browser/ui/views/tab_icon_view.h" | 19 #include "chrome/browser/ui/views/tab_icon_view.h" |
21 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 20 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
22 #include "chrome/browser/web_applications/web_app.h" | 21 #include "chrome/browser/web_applications/web_app.h" |
23 #include "chrome/grit/theme_resources.h" | 22 #include "chrome/grit/theme_resources.h" |
24 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
25 #include "services/ui/public/cpp/window.h" | 24 #include "services/ui/public/cpp/window.h" |
26 #include "ui/accessibility/ax_node_data.h" | 25 #include "ui/accessibility/ax_node_data.h" |
27 #include "ui/aura/client/aura_constants.h" | 26 #include "ui/aura/client/aura_constants.h" |
28 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 | 258 |
260 // TODO(sky): get immersive mode working. | 259 // TODO(sky): get immersive mode working. |
261 | 260 |
262 if (UseImmersiveLightbarHeaderStyle()) { | 261 if (UseImmersiveLightbarHeaderStyle()) { |
263 PaintImmersiveLightbarStyleHeader(canvas); | 262 PaintImmersiveLightbarStyleHeader(canvas); |
264 return; | 263 return; |
265 } | 264 } |
266 | 265 |
267 if (browser_view()->IsToolbarVisible()) | 266 if (browser_view()->IsToolbarVisible()) |
268 PaintToolbarBackground(canvas); | 267 PaintToolbarBackground(canvas); |
269 else if (!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()) | 268 else if (!UsePackagedAppHeaderStyle()) |
270 PaintContentEdge(canvas); | 269 PaintContentEdge(canvas); |
271 } | 270 } |
272 | 271 |
273 void BrowserNonClientFrameViewMus::Layout() { | 272 void BrowserNonClientFrameViewMus::Layout() { |
274 if (profile_indicator_icon()) | 273 if (profile_indicator_icon()) |
275 LayoutIncognitoButton(); | 274 LayoutIncognitoButton(); |
276 | 275 |
277 #if defined(FRAME_AVATAR_BUTTON) | 276 #if defined(FRAME_AVATAR_BUTTON) |
278 if (profile_switcher_.view()) | 277 if (profile_switcher_.view()) |
279 LayoutProfileSwitcher(); | 278 LayoutProfileSwitcher(); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 !immersive_controller->IsRevealed() && | 399 !immersive_controller->IsRevealed() && |
401 browser_view()->IsTabStripVisible(); | 400 browser_view()->IsTabStripVisible(); |
402 } | 401 } |
403 | 402 |
404 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const { | 403 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const { |
405 Browser* browser = browser_view()->browser(); | 404 Browser* browser = browser_view()->browser(); |
406 // For non tabbed trusted source windows, e.g. Settings, use the packaged | 405 // For non tabbed trusted source windows, e.g. Settings, use the packaged |
407 // app style frame. | 406 // app style frame. |
408 if (!browser->is_type_tabbed() && browser->is_trusted_source()) | 407 if (!browser->is_type_tabbed() && browser->is_trusted_source()) |
409 return true; | 408 return true; |
410 // Use the packaged app style for apps that aren't using the newer WebApp | 409 // Use the packaged app style for apps. |
411 // style. | 410 return browser->is_app(); |
tapted
2016/12/06 23:52:28
should this be a verbatim copy of `BrowserNonClien
benwells
2016/12/15 23:08:41
Um, yeah. Made identical.
| |
412 return browser->is_app() && !UseWebAppHeaderStyle(); | |
413 } | |
414 | |
415 bool BrowserNonClientFrameViewMus::UseWebAppHeaderStyle() const { | |
416 return browser_view()->browser()->SupportsWindowFeature( | |
417 Browser::FEATURE_WEBAPPFRAME); | |
418 } | 411 } |
419 | 412 |
420 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { | 413 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { |
421 DCHECK(profile_indicator_icon()); | 414 DCHECK(profile_indicator_icon()); |
422 #if !defined(OS_CHROMEOS) | 415 #if !defined(OS_CHROMEOS) |
423 // ChromeOS shows avatar on V1 app. | 416 // ChromeOS shows avatar on V1 app. |
424 DCHECK(browser_view()->IsTabStripVisible()); | 417 DCHECK(browser_view()->IsTabStripVisible()); |
425 #endif | 418 #endif |
426 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); | 419 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); |
427 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); | 420 const int pad = GetLayoutConstant(AVATAR_ICON_PADDING); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
500 | 493 |
501 // Toolbar/content separator. | 494 // Toolbar/content separator. |
502 toolbar_bounds.Inset(kClientEdgeThickness, 0); | 495 toolbar_bounds.Inset(kClientEdgeThickness, 0); |
503 BrowserView::Paint1pxHorizontalLine( | 496 BrowserView::Paint1pxHorizontalLine( |
504 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), | 497 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), |
505 toolbar_bounds, | 498 toolbar_bounds, |
506 true); | 499 true); |
507 } | 500 } |
508 | 501 |
509 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { | 502 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { |
510 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); | 503 DCHECK(!UsePackagedAppHeaderStyle()); |
511 const int bottom = frame_values().normal_insets.bottom(); | 504 const int bottom = frame_values().normal_insets.bottom(); |
512 canvas->FillRect( | 505 canvas->FillRect( |
513 gfx::Rect(0, bottom, width(), kClientEdgeThickness), | 506 gfx::Rect(0, bottom, width(), kClientEdgeThickness), |
514 GetThemeProvider()->GetColor( | 507 GetThemeProvider()->GetColor( |
515 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); | 508 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); |
516 } | 509 } |
OLD | NEW |