| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/tabs/tab_renderer.h" | 5 #include "chrome/browser/views/tabs/tab_renderer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "app/gfx/chrome_canvas.h" | 9 #include "app/gfx/chrome_canvas.h" |
| 10 #include "app/gfx/chrome_font.h" | 10 #include "app/gfx/chrome_font.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // How long the hover state takes. | 39 // How long the hover state takes. |
| 40 static const int kHoverDurationMs = 90; | 40 static const int kHoverDurationMs = 90; |
| 41 | 41 |
| 42 // How long the pulse throb takes. | 42 // How long the pulse throb takes. |
| 43 static const int kPulseDurationMs = 200; | 43 static const int kPulseDurationMs = 200; |
| 44 | 44 |
| 45 // How opaque to make the hover state (out of 1). | 45 // How opaque to make the hover state (out of 1). |
| 46 static const double kHoverOpacity = 0.33; | 46 static const double kHoverOpacity = 0.33; |
| 47 | 47 |
| 48 // TODO(beng): (Cleanup) This stuff should move onto the class. | 48 // TODO(beng): (Cleanup) This stuff should move onto the class. |
| 49 static ChromeFont* title_font = NULL; | 49 static gfx::Font* title_font = NULL; |
| 50 static int title_font_height = 0; | 50 static int title_font_height = 0; |
| 51 static SkBitmap* close_button_n = NULL; | 51 static SkBitmap* close_button_n = NULL; |
| 52 static SkBitmap* close_button_h = NULL; | 52 static SkBitmap* close_button_h = NULL; |
| 53 static SkBitmap* close_button_p = NULL; | 53 static SkBitmap* close_button_p = NULL; |
| 54 static int close_button_height = 0; | 54 static int close_button_height = 0; |
| 55 static int close_button_width = 0; | 55 static int close_button_width = 0; |
| 56 | 56 |
| 57 static SkBitmap* waiting_animation_frames = NULL; | 57 static SkBitmap* waiting_animation_frames = NULL; |
| 58 static SkBitmap* loading_animation_frames = NULL; | 58 static SkBitmap* loading_animation_frames = NULL; |
| 59 static SkBitmap* crashed_fav_icon = NULL; | 59 static SkBitmap* crashed_fav_icon = NULL; |
| 60 static int loading_animation_frame_count = 0; | 60 static int loading_animation_frame_count = 0; |
| 61 static int waiting_animation_frame_count = 0; | 61 static int waiting_animation_frame_count = 0; |
| 62 static int waiting_to_loading_frame_count_ratio = 0; | 62 static int waiting_to_loading_frame_count_ratio = 0; |
| 63 static SkBitmap* download_icon = NULL; | 63 static SkBitmap* download_icon = NULL; |
| 64 static int download_icon_width = 0; | 64 static int download_icon_width = 0; |
| 65 static int download_icon_height = 0; | 65 static int download_icon_height = 0; |
| 66 | 66 |
| 67 TabRenderer::TabImage TabRenderer::tab_alpha = {0}; | 67 TabRenderer::TabImage TabRenderer::tab_alpha = {0}; |
| 68 TabRenderer::TabImage TabRenderer::tab_active = {0}; | 68 TabRenderer::TabImage TabRenderer::tab_active = {0}; |
| 69 TabRenderer::TabImage TabRenderer::tab_inactive = {0}; | 69 TabRenderer::TabImage TabRenderer::tab_inactive = {0}; |
| 70 | 70 |
| 71 namespace { | 71 namespace { |
| 72 | 72 |
| 73 void InitResources() { | 73 void InitResources() { |
| 74 static bool initialized = false; | 74 static bool initialized = false; |
| 75 if (!initialized) { | 75 if (!initialized) { |
| 76 // TODO(glen): Allow theming of these. | 76 // TODO(glen): Allow theming of these. |
| 77 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 77 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 78 title_font = new ChromeFont(rb.GetFont(ResourceBundle::BaseFont)); | 78 title_font = new gfx::Font(rb.GetFont(ResourceBundle::BaseFont)); |
| 79 title_font_height = title_font->height(); | 79 title_font_height = title_font->height(); |
| 80 | 80 |
| 81 close_button_n = rb.GetBitmapNamed(IDR_TAB_CLOSE); | 81 close_button_n = rb.GetBitmapNamed(IDR_TAB_CLOSE); |
| 82 close_button_h = rb.GetBitmapNamed(IDR_TAB_CLOSE_H); | 82 close_button_h = rb.GetBitmapNamed(IDR_TAB_CLOSE_H); |
| 83 close_button_p = rb.GetBitmapNamed(IDR_TAB_CLOSE_P); | 83 close_button_p = rb.GetBitmapNamed(IDR_TAB_CLOSE_P); |
| 84 close_button_width = close_button_n->width(); | 84 close_button_width = close_button_n->width(); |
| 85 close_button_height = close_button_n->height(); | 85 close_button_height = close_button_n->height(); |
| 86 | 86 |
| 87 TabRenderer::LoadTabImages(); | 87 TabRenderer::LoadTabImages(); |
| 88 | 88 |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 783 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
| 784 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 784 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
| 785 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 785 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
| 786 | 786 |
| 787 tab_inactive.l_width = tab_inactive.image_l->width(); | 787 tab_inactive.l_width = tab_inactive.image_l->width(); |
| 788 tab_inactive.r_width = tab_inactive.image_r->width(); | 788 tab_inactive.r_width = tab_inactive.image_r->width(); |
| 789 | 789 |
| 790 loading_animation_frames = rb.GetBitmapNamed(IDR_THROBBER); | 790 loading_animation_frames = rb.GetBitmapNamed(IDR_THROBBER); |
| 791 waiting_animation_frames = rb.GetBitmapNamed(IDR_THROBBER_WAITING); | 791 waiting_animation_frames = rb.GetBitmapNamed(IDR_THROBBER_WAITING); |
| 792 } | 792 } |
| OLD | NEW |