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

Side by Side Diff: chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.cc

Issue 10736063: views: Extract TabIconViewModel into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months 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 | Annotate | Revision Log
OLDNEW
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/ash/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h"
6 6
7 #include "ash/wm/frame_painter.h" 7 #include "ash/wm/frame_painter.h"
8 #include "ash/wm/workspace/frame_maximize_button.h" 8 #include "ash/wm/workspace/frame_maximize_button.h"
9 #include "chrome/browser/themes/theme_service.h" 9 #include "chrome/browser/themes/theme_service.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/search/search.h" 11 #include "chrome/browser/ui/search/search.h"
12 #include "chrome/browser/ui/search/search_delegate.h" 12 #include "chrome/browser/ui/search/search_delegate.h"
13 #include "chrome/browser/ui/search/search_model.h" 13 #include "chrome/browser/ui/search/search_model.h"
14 #include "chrome/browser/ui/views/avatar_menu_button.h" 14 #include "chrome/browser/ui/views/avatar_menu_button.h"
15 #include "chrome/browser/ui/views/frame/browser_frame.h" 15 #include "chrome/browser/ui/views/frame/browser_frame.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/tab_icon_view.h"
17 #include "chrome/browser/ui/views/tabs/tab_strip.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip.h"
18 #include "chrome/browser/ui/views/toolbar_view.h" 19 #include "chrome/browser/ui/views/toolbar_view.h"
19 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
20 #include "grit/generated_resources.h" // Accessibility names 21 #include "grit/generated_resources.h" // Accessibility names
21 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
22 #include "grit/ui_resources.h" 23 #include "grit/ui_resources.h"
23 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/base/accessibility/accessible_view_state.h" 26 #include "ui/base/accessibility/accessible_view_state.h"
26 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 #include "ui/base/layout.h" 29 #include "ui/base/layout.h"
29 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/base/theme_provider.h" 31 #include "ui/base/theme_provider.h"
31 #include "ui/gfx/canvas.h" 32 #include "ui/gfx/canvas.h"
33 #include "ui/gfx/image/image_skia.h"
32 #include "ui/views/controls/button/image_button.h" 34 #include "ui/views/controls/button/image_button.h"
33 #include "ui/views/widget/widget.h" 35 #include "ui/views/widget/widget.h"
34 #include "ui/views/widget/widget_delegate.h" 36 #include "ui/views/widget/widget_delegate.h"
35 37
36 namespace { 38 namespace {
37 39
38 // The avatar ends 2 px above the bottom of the tabstrip (which, given the 40 // The avatar ends 2 px above the bottom of the tabstrip (which, given the
39 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the 41 // way the tabstrip draws its bottom edge, will appear like a 1 px gap to the
40 // user). 42 // user).
41 const int kAvatarBottomSpacing = 2; 43 const int kAvatarBottomSpacing = 2;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 frame()->Restore(); 376 frame()->Restore();
375 else 377 else
376 frame()->Maximize(); 378 frame()->Maximize();
377 // |this| may be deleted - some windows delete their frames on maximize. 379 // |this| may be deleted - some windows delete their frames on maximize.
378 } else if (sender == close_button_) { 380 } else if (sender == close_button_) {
379 frame()->Close(); 381 frame()->Close();
380 } 382 }
381 } 383 }
382 384
383 /////////////////////////////////////////////////////////////////////////////// 385 ///////////////////////////////////////////////////////////////////////////////
384 // TabIconView::TabIconViewModel overrides: 386 // chrome::TabIconViewModel overrides:
385 387
386 bool BrowserNonClientFrameViewAsh::ShouldTabIconViewAnimate() const { 388 bool BrowserNonClientFrameViewAsh::ShouldTabIconViewAnimate() const {
387 // This function is queried during the creation of the window as the 389 // This function is queried during the creation of the window as the
388 // TabIconView we host is initialized, so we need to NULL check the selected 390 // TabIconView we host is initialized, so we need to NULL check the selected
389 // WebContents because in this condition there is not yet a selected tab. 391 // WebContents because in this condition there is not yet a selected tab.
390 content::WebContents* current_tab = browser_view()->GetActiveWebContents(); 392 content::WebContents* current_tab = browser_view()->GetActiveWebContents();
391 return current_tab ? current_tab->IsLoading() : false; 393 return current_tab ? current_tab->IsLoading() : false;
392 } 394 }
393 395
394 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() { 396 gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { 592 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const {
591 ui::ThemeProvider* tp = GetThemeProvider(); 593 ui::ThemeProvider* tp = GetThemeProvider();
592 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 594 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
593 browser_view()->IsBrowserTypeNormal() && 595 browser_view()->IsBrowserTypeNormal() &&
594 !browser_view()->IsOffTheRecord()) { 596 !browser_view()->IsOffTheRecord()) {
595 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? 597 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ?
596 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); 598 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE);
597 } 599 }
598 return NULL; 600 return NULL;
599 } 601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698