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

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

Issue 10332152: Add TraySms for SMS messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only observe with --aura-notify 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 #include "ash/system/tray/tray_views.h" 5 #include "ash/system/tray/tray_views.h"
6 6
7 #include "ash/system/tray/tray_constants.h" 7 #include "ash/system/tray/tray_constants.h"
8 #include "third_party/skia/include/core/SkBitmap.h" 8 #include "third_party/skia/include/core/SkBitmap.h"
9 #include "grit/ash_strings.h" 9 #include "grit/ash_strings.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 18 matching lines...) Expand all
29 const int kPaddingAroundButtons = 5; 29 const int kPaddingAroundButtons = 5;
30 30
31 views::View* CreatePopupHeaderButtonsContainer() { 31 views::View* CreatePopupHeaderButtonsContainer() {
32 views::View* view = new views::View; 32 views::View* view = new views::View;
33 view->SetLayoutManager(new 33 view->SetLayoutManager(new
34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1)); 34 views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, -1));
35 view->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 5)); 35 view->set_border(views::Border::CreateEmptyBorder(0, 0, 0, 5));
36 return view; 36 return view;
37 } 37 }
38 38
39 const int kNotificationCloseButtonWidth = 60;
40 } 39 }
41 40
42 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
43 // FixedSizedImageView 42 // FixedSizedImageView
44 43
45 FixedSizedImageView::FixedSizedImageView(int width, int height) 44 FixedSizedImageView::FixedSizedImageView(int width, int height)
46 : width_(width), 45 : width_(width),
47 height_(height) { 46 height_(height) {
48 SetHorizontalAlignment(views::ImageView::CENTER); 47 SetHorizontalAlignment(views::ImageView::CENTER);
49 SetVerticalAlignment(views::ImageView::CENTER); 48 SetVerticalAlignment(views::ImageView::CENTER);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 456
458 TrayNotificationView::TrayNotificationView() { 457 TrayNotificationView::TrayNotificationView() {
459 } 458 }
460 459
461 void TrayNotificationView::InitView(views::View* contents) { 460 void TrayNotificationView::InitView(views::View* contents) {
462 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); 461 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
463 462
464 views::GridLayout* layout = new views::GridLayout(this); 463 views::GridLayout* layout = new views::GridLayout(this);
465 SetLayoutManager(layout); 464 SetLayoutManager(layout);
466 465
467 AddChildView(contents);
468
469 views::ImageButton* close_button = new views::ImageButton(this); 466 views::ImageButton* close_button = new views::ImageButton(this);
470 close_button->SetImage(views::CustomButton::BS_NORMAL, 467 close_button->SetImage(views::CustomButton::BS_NORMAL,
471 ResourceBundle::GetSharedInstance().GetBitmapNamed( 468 ResourceBundle::GetSharedInstance().GetBitmapNamed(
472 IDR_AURA_WINDOW_CLOSE)); 469 IDR_AURA_WINDOW_CLOSE));
473 AddChildView(close_button);
474 470
475 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth; 471 int contents_width = kTrayPopupWidth - kNotificationCloseButtonWidth;
476 views::ColumnSet* columns = layout->AddColumnSet(0); 472 views::ColumnSet* columns = layout->AddColumnSet(0);
477 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL, 473 columns->AddColumn(views::GridLayout::TRAILING, views::GridLayout::FILL,
478 0, /* resize percent */ 474 0, /* resize percent */
479 views::GridLayout::FIXED, 475 views::GridLayout::FIXED,
480 contents_width, 476 contents_width,
481 contents_width); 477 contents_width);
482 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 478 columns->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER,
483 0, /* resize percent */ 479 0, /* resize percent */
484 views::GridLayout::FIXED, 480 views::GridLayout::FIXED,
485 kNotificationCloseButtonWidth, 481 kNotificationCloseButtonWidth,
486 kNotificationCloseButtonWidth); 482 kNotificationCloseButtonWidth);
487 483
488 layout->StartRow(0, 0); 484 layout->StartRow(0, 0);
489 layout->AddView(contents); 485 layout->AddView(contents);
490 layout->AddView(close_button); 486 layout->AddView(close_button);
491 } 487 }
492 488
493 TrayNotificationView::~TrayNotificationView() { 489 TrayNotificationView::~TrayNotificationView() {
494 } 490 }
495 491
496 void TrayNotificationView::ButtonPressed(views::Button* sender, 492 void TrayNotificationView::ButtonPressed(views::Button* sender,
497 const views::Event& event) { 493 const views::Event& event) {
498 OnClose(); 494 OnClose();
499 } 495 }
500 496
501 } // namespace internal 497 } // namespace internal
502 } // namespace ash 498 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698