| OLD | NEW |
| 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 ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
| 10 #include "ui/gfx/font.h" | 10 #include "ui/gfx/font.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 virtual gfx::Size GetPreferredSize() OVERRIDE; | 236 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 237 virtual void Layout() OVERRIDE; | 237 virtual void Layout() OVERRIDE; |
| 238 | 238 |
| 239 views::View* content_; | 239 views::View* content_; |
| 240 views::View* button_container_; | 240 views::View* button_container_; |
| 241 views::Label* text_label_; | 241 views::Label* text_label_; |
| 242 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow); | 242 DISALLOW_COPY_AND_ASSIGN(SpecialPopupRow); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 // A view for closable notification views, laid out like: | 245 // A view for closable notification views, laid out like: |
| 246 // [ contents (x) ] | 246 // ------------------- |
| 247 // The close button will call OnClose() when pressed. | 247 // | icon contents x | |
| 248 // ----------------v-- |
| 249 // The close button will call OnClose() when clicked. |
| 248 class TrayNotificationView : public views::View, | 250 class TrayNotificationView : public views::View, |
| 249 public views::ButtonListener { | 251 public views::ButtonListener { |
| 250 public: | 252 public: |
| 251 TrayNotificationView(); | 253 // If icon_id is 0, no icon image will be set. SetIconImage can be called |
| 254 // to later set the icon image. |
| 255 explicit TrayNotificationView(int icon_id); |
| 252 virtual ~TrayNotificationView(); | 256 virtual ~TrayNotificationView(); |
| 253 | 257 |
| 254 // InitView must be called once with the contents to be displayed. | 258 // InitView must be called once with the contents to be displayed. |
| 255 void InitView(views::View* contents); | 259 void InitView(views::View* contents); |
| 256 | 260 |
| 261 // Sets/updates the icon image. |
| 262 void SetIconImage(const SkBitmap& image); |
| 263 |
| 264 // Replaces the contents view. |
| 265 void UpdateView(views::View* new_contents); |
| 266 |
| 267 // Replaces the contents view and updates the icon image. |
| 268 void UpdateViewAndImage(views::View* new_contents, const SkBitmap& image); |
| 269 |
| 257 // Overridden from ButtonListener. | 270 // Overridden from ButtonListener. |
| 258 virtual void ButtonPressed(views::Button* sender, | 271 virtual void ButtonPressed(views::Button* sender, |
| 259 const views::Event& event) OVERRIDE; | 272 const views::Event& event) OVERRIDE; |
| 260 | 273 |
| 261 protected: | 274 protected: |
| 262 // Called when the closed button is pressed. | 275 // Called when the closed button is pressed. |
| 263 virtual void OnClose() = 0; | 276 virtual void OnClose() = 0; |
| 264 | 277 |
| 265 private: | 278 private: |
| 279 int icon_id_; |
| 280 views::ImageView* icon_; |
| 281 |
| 266 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); | 282 DISALLOW_COPY_AND_ASSIGN(TrayNotificationView); |
| 267 }; | 283 }; |
| 268 | 284 |
| 269 // Sets up a Label properly for the tray (sets color, font etc.). | 285 // Sets up a Label properly for the tray (sets color, font etc.). |
| 270 void SetupLabelForTray(views::Label* label); | 286 void SetupLabelForTray(views::Label* label); |
| 271 | 287 |
| 272 } // namespace internal | 288 } // namespace internal |
| 273 } // namespace ash | 289 } // namespace ash |
| 274 | 290 |
| 275 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ | 291 #endif // ASH_SYSTEM_TRAY_TRAY_VIEWS_H_ |
| OLD | NEW |