Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc

Issue 2552903003: Remove unreleased web app frame code from ChromeOS (Closed)
Patch Set: Nits Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ui/accessibility/ax_node_data.h" 24 #include "ui/accessibility/ax_node_data.h"
26 #include "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
27 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
28 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 167
169 int BrowserNonClientFrameViewMus::GetThemeBackgroundXInset() const { 168 int BrowserNonClientFrameViewMus::GetThemeBackgroundXInset() const {
170 return 5; 169 return 5;
171 } 170 }
172 171
173 void BrowserNonClientFrameViewMus::UpdateThrobber(bool running) { 172 void BrowserNonClientFrameViewMus::UpdateThrobber(bool running) {
174 if (window_icon_) 173 if (window_icon_)
175 window_icon_->Update(); 174 window_icon_->Update();
176 } 175 }
177 176
178 void BrowserNonClientFrameViewMus::UpdateToolbar() {
179 }
180
181 views::View* BrowserNonClientFrameViewMus::GetLocationIconView() const {
182 return nullptr;
183 }
184
185 views::View* BrowserNonClientFrameViewMus::GetProfileSwitcherView() const { 177 views::View* BrowserNonClientFrameViewMus::GetProfileSwitcherView() const {
186 #if defined(FRAME_AVATAR_BUTTON) 178 #if defined(FRAME_AVATAR_BUTTON)
187 return profile_switcher_.view(); 179 return profile_switcher_.view();
188 #else 180 #else
189 return nullptr; 181 return nullptr;
190 #endif 182 #endif
191 } 183 }
192 184
193 /////////////////////////////////////////////////////////////////////////////// 185 ///////////////////////////////////////////////////////////////////////////////
194 // views::NonClientFrameView: 186 // views::NonClientFrameView:
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 251
260 // TODO(sky): get immersive mode working. 252 // TODO(sky): get immersive mode working.
261 253
262 if (UseImmersiveLightbarHeaderStyle()) { 254 if (UseImmersiveLightbarHeaderStyle()) {
263 PaintImmersiveLightbarStyleHeader(canvas); 255 PaintImmersiveLightbarStyleHeader(canvas);
264 return; 256 return;
265 } 257 }
266 258
267 if (browser_view()->IsToolbarVisible()) 259 if (browser_view()->IsToolbarVisible())
268 PaintToolbarBackground(canvas); 260 PaintToolbarBackground(canvas);
269 else if (!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()) 261 else if (!UsePackagedAppHeaderStyle())
270 PaintContentEdge(canvas); 262 PaintContentEdge(canvas);
271 } 263 }
272 264
273 void BrowserNonClientFrameViewMus::Layout() { 265 void BrowserNonClientFrameViewMus::Layout() {
274 if (profile_indicator_icon()) 266 if (profile_indicator_icon())
275 LayoutIncognitoButton(); 267 LayoutIncognitoButton();
276 268
277 #if defined(FRAME_AVATAR_BUTTON) 269 #if defined(FRAME_AVATAR_BUTTON)
278 if (profile_switcher_.view()) 270 if (profile_switcher_.view())
279 LayoutProfileSwitcher(); 271 LayoutProfileSwitcher();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 386
395 bool BrowserNonClientFrameViewMus::UseImmersiveLightbarHeaderStyle() const { 387 bool BrowserNonClientFrameViewMus::UseImmersiveLightbarHeaderStyle() const {
396 ImmersiveModeController* immersive_controller = 388 ImmersiveModeController* immersive_controller =
397 browser_view()->immersive_mode_controller(); 389 browser_view()->immersive_mode_controller();
398 return immersive_controller->IsEnabled() && 390 return immersive_controller->IsEnabled() &&
399 !immersive_controller->IsRevealed() && 391 !immersive_controller->IsRevealed() &&
400 browser_view()->IsTabStripVisible(); 392 browser_view()->IsTabStripVisible();
401 } 393 }
402 394
403 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const { 395 bool BrowserNonClientFrameViewMus::UsePackagedAppHeaderStyle() const {
404 Browser* browser = browser_view()->browser(); 396 // Use for non tabbed trusted source windows, e.g. Settings, as well as apps.
405 // For non tabbed trusted source windows, e.g. Settings, use the packaged 397 const Browser* const browser = browser_view()->browser();
406 // app style frame. 398 return (!browser->is_type_tabbed() && browser->is_trusted_source()) ||
407 if (!browser->is_type_tabbed() && browser->is_trusted_source()) 399 browser->is_app();
408 return true;
409 // Use the packaged app style for apps that aren't using the newer WebApp
410 // style.
411 return browser->is_app() && !UseWebAppHeaderStyle();
412 }
413
414 bool BrowserNonClientFrameViewMus::UseWebAppHeaderStyle() const {
415 return browser_view()->browser()->SupportsWindowFeature(
416 Browser::FEATURE_WEBAPPFRAME);
417 } 400 }
418 401
419 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() { 402 void BrowserNonClientFrameViewMus::LayoutIncognitoButton() {
420 DCHECK(profile_indicator_icon()); 403 DCHECK(profile_indicator_icon());
421 #if !defined(OS_CHROMEOS) 404 #if !defined(OS_CHROMEOS)
422 // ChromeOS shows avatar on V1 app. 405 // ChromeOS shows avatar on V1 app.
423 DCHECK(browser_view()->IsTabStripVisible()); 406 DCHECK(browser_view()->IsTabStripVisible());
424 #endif 407 #endif
425 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon(); 408 gfx::ImageSkia incognito_icon = GetIncognitoAvatarIcon();
426 int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() - 409 int avatar_bottom = GetTopInset(false) + browser_view()->GetTabStripHeight() -
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 482
500 // Toolbar/content separator. 483 // Toolbar/content separator.
501 toolbar_bounds.Inset(kClientEdgeThickness, 0); 484 toolbar_bounds.Inset(kClientEdgeThickness, 0);
502 BrowserView::Paint1pxHorizontalLine( 485 BrowserView::Paint1pxHorizontalLine(
503 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR), 486 canvas, tp->GetColor(ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR),
504 toolbar_bounds, 487 toolbar_bounds,
505 true); 488 true);
506 } 489 }
507 490
508 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) { 491 void BrowserNonClientFrameViewMus::PaintContentEdge(gfx::Canvas* canvas) {
509 DCHECK(!UsePackagedAppHeaderStyle() && !UseWebAppHeaderStyle()); 492 DCHECK(!UsePackagedAppHeaderStyle());
510 const int bottom = frame_values().normal_insets.bottom(); 493 const int bottom = frame_values().normal_insets.bottom();
511 canvas->FillRect( 494 canvas->FillRect(
512 gfx::Rect(0, bottom, width(), kClientEdgeThickness), 495 gfx::Rect(0, bottom, width(), kClientEdgeThickness),
513 GetThemeProvider()->GetColor( 496 GetThemeProvider()->GetColor(
514 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR)); 497 ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR));
515 } 498 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698