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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.h

Issue 1354823002: Render the tab close button as a vector-based icon. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reset title color in same place Created 5 years, 3 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
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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // See description above field. 62 // See description above field.
63 void set_dragging(bool dragging) { dragging_ = dragging; } 63 void set_dragging(bool dragging) { dragging_ = dragging; }
64 bool dragging() const { return dragging_; } 64 bool dragging() const { return dragging_; }
65 65
66 // Used to mark the tab as having been detached. Once this has happened, the 66 // Used to mark the tab as having been detached. Once this has happened, the
67 // tab should be invisibly closed. This is irreversible. 67 // tab should be invisibly closed. This is irreversible.
68 void set_detached() { detached_ = true; } 68 void set_detached() { detached_ = true; }
69 bool detached() const { return detached_; } 69 bool detached() const { return detached_; }
70 70
71 SkColor button_color() const { return button_color_; }
72
71 // Sets the container all animations run from. 73 // Sets the container all animations run from.
72 void set_animation_container(gfx::AnimationContainer* container); 74 void SetAnimationContainer(gfx::AnimationContainer* container);
73 75
74 // Returns true if this tab is the active tab. 76 // Returns true if this tab is the active tab.
75 bool IsActive() const; 77 bool IsActive() const;
76 78
77 // Notifies the MediaIndicatorButton that the active state of this tab has 79 // Notifies the MediaIndicatorButton that the active state of this tab has
78 // changed. 80 // changed.
79 void ActiveStateChanged(); 81 void ActiveStateChanged();
80 82
81 // Returns true if the tab is selected. 83 // Returns true if the tab is selected.
82 bool IsSelected() const; 84 bool IsSelected() const;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 191
190 // views::ContextMenuController: 192 // views::ContextMenuController:
191 void ShowContextMenuForView(views::View* source, 193 void ShowContextMenuForView(views::View* source,
192 const gfx::Point& point, 194 const gfx::Point& point,
193 ui::MenuSourceType source_type) override; 195 ui::MenuSourceType source_type) override;
194 196
195 // views::MaskedTargeterDelegate: 197 // views::MaskedTargeterDelegate:
196 bool GetHitTestMask(gfx::Path* mask) const override; 198 bool GetHitTestMask(gfx::Path* mask) const override;
197 199
198 // views::View: 200 // views::View:
201 void ViewHierarchyChanged(
202 const ViewHierarchyChangedDetails& details) override;
199 void OnPaint(gfx::Canvas* canvas) override; 203 void OnPaint(gfx::Canvas* canvas) override;
200 void Layout() override; 204 void Layout() override;
201 void OnThemeChanged() override; 205 void OnThemeChanged() override;
202 const char* GetClassName() const override; 206 const char* GetClassName() const override;
203 bool GetTooltipText(const gfx::Point& p, 207 bool GetTooltipText(const gfx::Point& p,
204 base::string16* tooltip) const override; 208 base::string16* tooltip) const override;
205 bool GetTooltipTextOrigin(const gfx::Point& p, 209 bool GetTooltipTextOrigin(const gfx::Point& p,
206 gfx::Point* origin) const override; 210 gfx::Point* origin) const override;
207 bool OnMousePressed(const ui::MouseEvent& event) override; 211 bool OnMousePressed(const ui::MouseEvent& event) override;
208 bool OnMouseDragged(const ui::MouseEvent& event) override; 212 bool OnMouseDragged(const ui::MouseEvent& event) override;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 276
273 void DisplayCrashedFavicon(); 277 void DisplayCrashedFavicon();
274 void ResetCrashedFavicon(); 278 void ResetCrashedFavicon();
275 279
276 void StopCrashAnimation(); 280 void StopCrashAnimation();
277 void StartCrashAnimation(); 281 void StartCrashAnimation();
278 282
279 // Returns true if the crash animation is currently running. 283 // Returns true if the crash animation is currently running.
280 bool IsPerformingCrashAnimation() const; 284 bool IsPerformingCrashAnimation() const;
281 285
286 // Recalculates the correct |button_color_| and resets the title, media
287 // indicator, and close button colors if necessary. This should be called any
288 // time the theme or active state may have changed.
289 void OnButtonColorMaybeChanged();
290
282 // Schedules repaint task for icon. 291 // Schedules repaint task for icon.
283 void ScheduleIconPaint(); 292 void ScheduleIconPaint();
284 293
285 // Returns a |path| containing the region that matches the bitmap display of 294 // Returns a |path| containing the region that matches the bitmap display of
286 // this tab, for input event hit testing. Set |include_top_shadow| to include 295 // this tab, for input event hit testing. Set |include_top_shadow| to include
287 // the mostly-transparent shadow pixels above the top edge of the tab in the 296 // the mostly-transparent shadow pixels above the top edge of the tab in the
288 // path. 297 // path.
289 void GetHitTestMaskHelper(bool include_top_shadow, gfx::Path* path) const; 298 void GetHitTestMaskHelper(bool include_top_shadow, gfx::Path* path) const;
290 299
291 // Returns the rectangle for the light bar in immersive mode. 300 // Returns the rectangle for the light bar in immersive mode.
292 gfx::Rect GetImmersiveBarRect() const; 301 gfx::Rect GetImmersiveBarRect() const;
293 302
294 // Gets the tab id and frame id. 303 // Gets the tab id and frame id.
295 void GetTabIdAndFrameId(views::Widget* widget, 304 void GetTabIdAndFrameId(views::Widget* widget,
296 int* tab_id, 305 int* tab_id,
297 int* frame_id) const; 306 int* frame_id) const;
298 307
299 // Returns |media_indicator_button_|, creating it on-demand.
300 MediaIndicatorButton* GetMediaIndicatorButton();
301
302 // Performs a one-time initialization of static resources such as tab images. 308 // Performs a one-time initialization of static resources such as tab images.
303 static void InitTabResources(); 309 static void InitTabResources();
304 310
305 // Loads the images to be used for the tab background. 311 // Loads the images to be used for the tab background.
306 static void LoadTabImages(); 312 static void LoadTabImages();
307 313
308 // Returns the cached image for the specified arguments, or an empty image if 314 // Returns the cached image for the specified arguments, or an empty image if
309 // there isn't one cached. 315 // there isn't one cached.
310 static gfx::ImageSkia GetCachedImage(int resource_id, 316 static gfx::ImageSkia GetCachedImage(int resource_id,
311 const gfx::Size& size, 317 const gfx::Size& size,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Whole-tab throbbing "pulse" animation. 357 // Whole-tab throbbing "pulse" animation.
352 scoped_ptr<gfx::ThrobAnimation> pulse_animation_; 358 scoped_ptr<gfx::ThrobAnimation> pulse_animation_;
353 359
354 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_; 360 scoped_ptr<gfx::MultiAnimation> pinned_title_change_animation_;
355 361
356 // Crash icon animation (in place of favicon). 362 // Crash icon animation (in place of favicon).
357 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_; 363 scoped_ptr<gfx::LinearAnimation> crash_icon_animation_;
358 364
359 scoped_refptr<gfx::AnimationContainer> animation_container_; 365 scoped_refptr<gfx::AnimationContainer> animation_container_;
360 366
367 MediaIndicatorButton* media_indicator_button_;
361 views::ImageButton* close_button_; 368 views::ImageButton* close_button_;
362 MediaIndicatorButton* media_indicator_button_; // NULL until first use.
363 views::Label* title_; 369 views::Label* title_;
364 370
365 bool tab_activated_with_last_tap_down_; 371 bool tab_activated_with_last_tap_down_;
366 372
367 views::GlowHoverController hover_controller_; 373 views::GlowHoverController hover_controller_;
368 374
369 // The bounds of various sections of the display. 375 // The bounds of various sections of the display.
370 gfx::Rect favicon_bounds_; 376 gfx::Rect favicon_bounds_;
371 377
372 // The offset used to paint the inactive background image. 378 // The offset used to paint the inactive background image.
(...skipping 15 matching lines...) Expand all
388 bool showing_icon_; 394 bool showing_icon_;
389 395
390 // Whether we're showing the media indicator. It is cached so that we can 396 // Whether we're showing the media indicator. It is cached so that we can
391 // detect when it changes and layout appropriately. 397 // detect when it changes and layout appropriately.
392 bool showing_media_indicator_; 398 bool showing_media_indicator_;
393 399
394 // Whether we are showing the close button. It is cached so that we can 400 // Whether we are showing the close button. It is cached so that we can
395 // detect when it changes and layout appropriately. 401 // detect when it changes and layout appropriately.
396 bool showing_close_button_; 402 bool showing_close_button_;
397 403
398 // The current color of the close button. 404 // The current color of the media indicator and close button icons.
399 SkColor close_button_color_; 405 SkColor button_color_;
400 406
401 // As the majority of the tabs are inactive, and painting tabs is slowish, 407 // As the majority of the tabs are inactive, and painting tabs is slowish,
402 // we cache a handful of the inactive tab backgrounds here. 408 // we cache a handful of the inactive tab backgrounds here.
403 static ImageCache* image_cache_; 409 static ImageCache* image_cache_;
404 410
405 DISALLOW_COPY_AND_ASSIGN(Tab); 411 DISALLOW_COPY_AND_ASSIGN(Tab);
406 }; 412 };
407 413
408 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_ 414 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698