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

Side by Side Diff: ash/common/system/chromeos/screen_security/screen_capture_tray_item.cc

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: merge Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/screen_security/screen_capture_tray_item.h" 5 #include "ash/common/system/chromeos/screen_security/screen_capture_tray_item.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/metrics/user_metrics_action.h" 9 #include "ash/common/metrics/user_metrics_action.h"
10 #include "ash/common/system/system_notifier.h" 10 #include "ash/common/system/system_notifier.h"
11 #include "ash/common/system/tray/system_tray_notifier.h" 11 #include "ash/common/system/tray/system_tray_notifier.h"
12 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
13 #include "ash/resources/grit/ash_resources.h" 13 #include "ash/resources/grit/ash_resources.h"
14 #include "ash/shell.h"
14 #include "ash/strings/grit/ash_strings.h" 15 #include "ash/strings/grit/ash_strings.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/message_center/message_center.h" 18 #include "ui/message_center/message_center.h"
18 #include "ui/message_center/notification.h" 19 #include "ui/message_center/notification.h"
19 20
20 using message_center::Notification; 21 using message_center::Notification;
21 22
22 namespace ash { 23 namespace ash {
23 namespace { 24 namespace {
24 25
25 const char kScreenCaptureNotificationId[] = "chrome://screen/capture"; 26 const char kScreenCaptureNotificationId[] = "chrome://screen/capture";
26 27
27 } // namespace 28 } // namespace
28 29
29 ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray) 30 ScreenCaptureTrayItem::ScreenCaptureTrayItem(SystemTray* system_tray)
30 : ScreenTrayItem(system_tray, UMA_SCREEN_CAPTURE) { 31 : ScreenTrayItem(system_tray, UMA_SCREEN_CAPTURE) {
31 WmShell::Get()->AddShellObserver(this); 32 Shell::GetInstance()->AddShellObserver(this);
32 WmShell::Get()->system_tray_notifier()->AddScreenCaptureObserver(this); 33 WmShell::Get()->system_tray_notifier()->AddScreenCaptureObserver(this);
33 } 34 }
34 35
35 ScreenCaptureTrayItem::~ScreenCaptureTrayItem() { 36 ScreenCaptureTrayItem::~ScreenCaptureTrayItem() {
36 WmShell::Get()->RemoveShellObserver(this); 37 Shell::GetInstance()->RemoveShellObserver(this);
37 WmShell::Get()->system_tray_notifier()->RemoveScreenCaptureObserver(this); 38 WmShell::Get()->system_tray_notifier()->RemoveScreenCaptureObserver(this);
38 } 39 }
39 40
40 views::View* ScreenCaptureTrayItem::CreateDefaultView(LoginStatus status) { 41 views::View* ScreenCaptureTrayItem::CreateDefaultView(LoginStatus status) {
41 set_default_view(new tray::ScreenStatusView( 42 set_default_view(new tray::ScreenStatusView(
42 this, screen_capture_status_, 43 this, screen_capture_status_,
43 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SCREEN_CAPTURE_STOP))); 44 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SCREEN_CAPTURE_STOP)));
44 return default_view(); 45 return default_view();
45 } 46 }
46 47
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // screen capture is stopped externally. 100 // screen capture is stopped externally.
100 set_is_started(false); 101 set_is_started(false);
101 Update(); 102 Update();
102 } 103 }
103 104
104 void ScreenCaptureTrayItem::OnCastingSessionStartedOrStopped(bool started) { 105 void ScreenCaptureTrayItem::OnCastingSessionStartedOrStopped(bool started) {
105 is_casting_ = started; 106 is_casting_ = started;
106 } 107 }
107 108
108 } // namespace ash 109 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698