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

Unified Diff: chrome/browser/chromeos/display/output_protection_delegate.cc

Issue 1122353002: PepperOutputProtectionMessageFilter: set window_ only when client_id_ is valid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/display/output_protection_delegate.cc
diff --git a/chrome/browser/chromeos/display/output_protection_delegate.cc b/chrome/browser/chromeos/display/output_protection_delegate.cc
index 53c1af1d2c5510e80a745df2115a372a31b19cb7..f5eb56dba54a4a637be3f92f3856d9a553d99b26 100644
--- a/chrome/browser/chromeos/display/output_protection_delegate.cc
+++ b/chrome/browser/chromeos/display/output_protection_delegate.cc
@@ -19,6 +19,9 @@ namespace {
bool GetCurrentDisplayId(content::RenderFrameHost* rfh, int64* display_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(rfh);
+ DCHECK(display_id);
+
gfx::NativeView native_view = rfh->GetNativeView();
gfx::Screen* screen = gfx::Screen::GetScreenFor(native_view);
if (!screen)
@@ -61,19 +64,21 @@ OutputProtectionDelegate::GetClientId() {
if (client_id_ == ui::DisplayConfigurator::kInvalidClientId) {
content::RenderFrameHost* rfh =
content::RenderFrameHost::FromID(render_process_id_, render_frame_id_);
- if (!GetCurrentDisplayId(rfh, &display_id_))
+ if (!rfh || !GetCurrentDisplayId(rfh, &display_id_))
return ui::DisplayConfigurator::kInvalidClientId;
- window_ = rfh->GetNativeView();
- if (!window_)
+ aura::Window* window = rfh->GetNativeView();
+ if (!window)
return ui::DisplayConfigurator::kInvalidClientId;
ui::DisplayConfigurator* configurator =
ash::Shell::GetInstance()->display_configurator();
client_id_ = configurator->RegisterContentProtectionClient();
- if (client_id_ != ui::DisplayConfigurator::kInvalidClientId)
- window_->AddObserver(this);
+ if (client_id_ != ui::DisplayConfigurator::kInvalidClientId) {
+ window->AddObserver(this);
+ window_ = window;
+ }
}
return client_id_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698