OLD | NEW |
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 "chrome/browser/chromeos/display/output_protection_delegate.h" | 5 #include "chrome/browser/chromeos/display/output_protection_delegate.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/display/output_protection_controller_ash.h" | 7 #include "chrome/browser/chromeos/display/output_protection_controller_ash.h" |
8 #include "chrome/browser/chromeos/display/output_protection_controller_mus.h" | 8 #include "chrome/browser/chromeos/display/output_protection_controller_mus.h" |
9 #include "chrome/browser/ui/ash/ash_util.h" | 9 #include "chrome/browser/ui/ash/ash_util.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 int64_t display_id = display::kInvalidDisplayId; | 97 int64_t display_id = display::kInvalidDisplayId; |
98 if (!GetCurrentDisplayId(rfh, &display_id)) | 98 if (!GetCurrentDisplayId(rfh, &display_id)) |
99 return false; | 99 return false; |
100 | 100 |
101 aura::Window* window = rfh->GetNativeView(); | 101 aura::Window* window = rfh->GetNativeView(); |
102 if (!window) | 102 if (!window) |
103 return false; | 103 return false; |
104 | 104 |
105 if (ash_util::IsRunningInMash()) | 105 if (IsRunningInMash()) |
106 controller_ = base::MakeUnique<OutputProtectionControllerMus>(); | 106 controller_ = base::MakeUnique<OutputProtectionControllerMus>(); |
107 else | 107 else |
108 controller_ = base::MakeUnique<OutputProtectionControllerAsh>(); | 108 controller_ = base::MakeUnique<OutputProtectionControllerAsh>(); |
109 | 109 |
110 display_id_ = display_id; | 110 display_id_ = display_id; |
111 window_ = window; | 111 window_ = window; |
112 window_->AddObserver(this); | 112 window_->AddObserver(this); |
113 return true; | 113 return true; |
114 } | 114 } |
115 | 115 |
(...skipping 24 matching lines...) Expand all Loading... |
140 display_id_ = new_display_id; | 140 display_id_ = new_display_id; |
141 } | 141 } |
142 | 142 |
143 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { | 143 void OutputProtectionDelegate::OnWindowDestroying(aura::Window* window) { |
144 DCHECK_EQ(window, window_); | 144 DCHECK_EQ(window, window_); |
145 window_->RemoveObserver(this); | 145 window_->RemoveObserver(this); |
146 window_ = nullptr; | 146 window_ = nullptr; |
147 } | 147 } |
148 | 148 |
149 } // namespace chromeos | 149 } // namespace chromeos |
OLD | NEW |