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

Side by Side Diff: ash/common/system/date/date_default_view.cc

Issue 2330403002: Do not activate system tray bubble by default (Closed)
Patch Set: Do not activate system tray bubble by default Created 4 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
« no previous file with comments | « ash/common/system/date/date_default_view.h ('k') | ash/common/system/date/date_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/common/system/date/date_default_view.h" 5 #include "ash/common/system/date/date_default_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/metrics/user_metrics_action.h" 8 #include "ash/common/metrics/user_metrics_action.h"
9 #include "ash/common/session/session_state_delegate.h" 9 #include "ash/common/session/session_state_delegate.h"
10 #include "ash/common/system/date/date_view.h" 10 #include "ash/common/system/date/date_view.h"
11 #include "ash/common/system/tray/special_popup_row.h" 11 #include "ash/common/system/tray/special_popup_row.h"
12 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
13 #include "ash/common/system/tray/tray_constants.h" 14 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_header_button.h" 15 #include "ash/common/system/tray/tray_popup_header_button.h"
15 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
16 #include "ash/resources/vector_icons/vector_icons.h" 17 #include "ash/resources/vector_icons/vector_icons.h"
17 #include "base/i18n/rtl.h" 18 #include "base/i18n/rtl.h"
18 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
19 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/gfx/paint_vector_icon.h" 22 #include "ui/gfx/paint_vector_icon.h"
(...skipping 12 matching lines...) Expand all
34 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is 35 // The ISO-639 code for the Hebrew locale. The help icon asset is a '?' which is
35 // not mirrored in this locale. 36 // not mirrored in this locale.
36 const char kHebrewLocale[] = "he"; 37 const char kHebrewLocale[] = "he";
37 38
38 const int kPaddingVertical = 19; 39 const int kPaddingVertical = 19;
39 40
40 } // namespace 41 } // namespace
41 42
42 namespace ash { 43 namespace ash {
43 44
44 DateDefaultView::DateDefaultView(LoginStatus login) 45 DateDefaultView::DateDefaultView(SystemTrayItem* owner, LoginStatus login)
45 : help_button_(NULL), 46 : help_button_(nullptr),
46 shutdown_button_(NULL), 47 shutdown_button_(nullptr),
47 lock_button_(NULL), 48 lock_button_(nullptr),
48 date_view_(NULL), 49 date_view_(nullptr),
49 weak_factory_(this) { 50 weak_factory_(this) {
50 SetLayoutManager(new views::FillLayout); 51 SetLayoutManager(new views::FillLayout);
51 52
52 date_view_ = new tray::DateView(); 53 date_view_ = new tray::DateView(owner);
53 date_view_->SetBorder(views::Border::CreateEmptyBorder( 54 date_view_->SetBorder(views::Border::CreateEmptyBorder(
54 kPaddingVertical, ash::kTrayPopupPaddingHorizontal, 0, 0)); 55 kPaddingVertical, ash::kTrayPopupPaddingHorizontal, 0, 0));
55 SpecialPopupRow* view = new SpecialPopupRow(); 56 SpecialPopupRow* view = new SpecialPopupRow();
56 view->SetContent(date_view_); 57 view->SetContent(date_view_);
57 AddChildView(view); 58 AddChildView(view);
58 59
59 WmShell* shell = WmShell::Get(); 60 WmShell* shell = WmShell::Get();
60 const bool adding_user = 61 const bool adding_user =
61 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen(); 62 shell->GetSessionStateDelegate()->IsInSecondaryLoginScreen();
62 63
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } else if (sender == lock_button_) { 160 } else if (sender == lock_button_) {
160 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN); 161 shell->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN);
161 #if defined(OS_CHROMEOS) 162 #if defined(OS_CHROMEOS)
162 chromeos::DBusThreadManager::Get() 163 chromeos::DBusThreadManager::Get()
163 ->GetSessionManagerClient() 164 ->GetSessionManagerClient()
164 ->RequestLockScreen(); 165 ->RequestLockScreen();
165 #endif 166 #endif
166 } else { 167 } else {
167 NOTREACHED(); 168 NOTREACHED();
168 } 169 }
170 date_view_->CloseSystemBubble();
169 } 171 }
170 172
171 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) { 173 void DateDefaultView::OnShutdownPolicyChanged(bool reboot_on_shutdown) {
172 if (!shutdown_button_) 174 if (!shutdown_button_)
173 return; 175 return;
174 176
175 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16( 177 shutdown_button_->SetTooltipText(l10n_util::GetStringUTF16(
176 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT 178 reboot_on_shutdown ? IDS_ASH_STATUS_TRAY_REBOOT
177 : IDS_ASH_STATUS_TRAY_SHUTDOWN)); 179 : IDS_ASH_STATUS_TRAY_SHUTDOWN));
178 } 180 }
179 181
180 } // namespace ash 182 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/date/date_default_view.h ('k') | ash/common/system/date/date_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698