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

Side by Side Diff: content/public/browser/screen_orientation_provider.cc

Issue 2564953003: Fix reversed DCHECK() in ScreenOrientationProvider. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | 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 "content/public/browser/screen_orientation_provider.h" 5 #include "content/public/browser/screen_orientation_provider.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/optional.h" 8 #include "base/optional.h"
9 #include "content/browser/renderer_host/render_view_host_impl.h" 9 #include "content/browser/renderer_host/render_view_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 10 matching lines...) Expand all
21 21
22 ScreenOrientationProvider::ScreenOrientationProvider(WebContents* web_contents) 22 ScreenOrientationProvider::ScreenOrientationProvider(WebContents* web_contents)
23 : WebContentsObserver(web_contents), lock_applied_(false) {} 23 : WebContentsObserver(web_contents), lock_applied_(false) {}
24 24
25 ScreenOrientationProvider::~ScreenOrientationProvider() { 25 ScreenOrientationProvider::~ScreenOrientationProvider() {
26 } 26 }
27 27
28 void ScreenOrientationProvider::LockOrientation( 28 void ScreenOrientationProvider::LockOrientation(
29 blink::WebScreenOrientationLockType orientation, 29 blink::WebScreenOrientationLockType orientation,
30 const LockOrientationCallback& callback) { 30 const LockOrientationCallback& callback) {
31 // ScreenOrientation should have cancelled all pending request at thie point. 31 // ScreenOrientation should have cancelled all pending request at this point.
32 DCHECK(on_result_callback_.is_null()); 32 DCHECK(on_result_callback_.is_null());
33 DCHECK(pending_lock_orientation_.has_value()); 33 DCHECK(!pending_lock_orientation_.has_value());
34 DCHECK(pending_lock_orientation_.value() >= 0);
35 on_result_callback_ = callback; 34 on_result_callback_ = callback;
36 35
37 if (!delegate_ || !delegate_->ScreenOrientationProviderSupported()) { 36 if (!delegate_ || !delegate_->ScreenOrientationProviderSupported()) {
38 NotifyLockResult(ScreenOrientationLockResult:: 37 NotifyLockResult(ScreenOrientationLockResult::
39 SCREEN_ORIENTATION_LOCK_RESULT_ERROR_NOT_AVAILABLE); 38 SCREEN_ORIENTATION_LOCK_RESULT_ERROR_NOT_AVAILABLE);
40 return; 39 return;
41 } 40 }
42 41
43 if (delegate_->FullScreenRequired(web_contents())) { 42 if (delegate_->FullScreenRequired(web_contents())) {
44 RenderViewHostImpl* rvhi = 43 RenderViewHostImpl* rvhi =
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 case blink::WebScreenOrientationLockDefault: 200 case blink::WebScreenOrientationLockDefault:
202 NOTREACHED(); 201 NOTREACHED();
203 return false; 202 return false;
204 } 203 }
205 204
206 NOTREACHED(); 205 NOTREACHED();
207 return false; 206 return false;
208 } 207 }
209 208
210 } // namespace content 209 } // namespace content
OLDNEW
« 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