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

Side by Side Diff: ash/system/tray/tray_views.h

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

Powered by Google App Engine
This is Rietveld 408576698