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

Side by Side Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm

Issue 2769333006: Replace unique_ptr.reset(other_unique_ptr.release()) with std::move() in chrome/browser (Closed)
Patch Set: 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/cocoa/constrained_window/constrained_window_mac.h" 5 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 ConstrainedWindowMac::~ConstrainedWindowMac() { 54 ConstrainedWindowMac::~ConstrainedWindowMac() {
55 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 55 CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
56 native_manager_.reset(); 56 native_manager_.reset();
57 DCHECK(!manager_); 57 DCHECK(!manager_);
58 } 58 }
59 59
60 void ConstrainedWindowMac::ShowWebContentsModalDialog() { 60 void ConstrainedWindowMac::ShowWebContentsModalDialog() {
61 std::unique_ptr<SingleWebContentsDialogManagerCocoa> dialog_manager; 61 std::unique_ptr<SingleWebContentsDialogManagerCocoa> dialog_manager;
62 dialog_manager.reset(native_manager_.release()); 62 dialog_manager = std::move(native_manager_);
63 GetDialogManager()->ShowDialogWithManager( 63 GetDialogManager()->ShowDialogWithManager(
64 [sheet_.get() sheetWindow], std::move(dialog_manager)); 64 [sheet_.get() sheetWindow], std::move(dialog_manager));
65 } 65 }
66 66
67 void ConstrainedWindowMac::CloseWebContentsModalDialog() { 67 void ConstrainedWindowMac::CloseWebContentsModalDialog() {
68 if (manager_) 68 if (manager_)
69 manager_->Close(); 69 manager_->Close();
70 } 70 }
71 71
72 void ConstrainedWindowMac::OnDialogClosing() { 72 void ConstrainedWindowMac::OnDialogClosing() {
(...skipping 10 matching lines...) Expand all
83 DCHECK(web_contents_); 83 DCHECK(web_contents_);
84 WebContentsModalDialogManager* dialog_manager = 84 WebContentsModalDialogManager* dialog_manager =
85 WebContentsModalDialogManager::FromWebContents(web_contents_); 85 WebContentsModalDialogManager::FromWebContents(web_contents_);
86 // If WebContentsModalDialogManager::CreateForWebContents(web_contents_) was 86 // If WebContentsModalDialogManager::CreateForWebContents(web_contents_) was
87 // never called, then the manager will be null. E.g., for browser tabs, 87 // never called, then the manager will be null. E.g., for browser tabs,
88 // TabHelpers::AttachTabHelpers() calls CreateForWebContents(). It is invalid 88 // TabHelpers::AttachTabHelpers() calls CreateForWebContents(). It is invalid
89 // to show a dialog on some kinds of WebContents. Crash cleanly in that case. 89 // to show a dialog on some kinds of WebContents. Crash cleanly in that case.
90 CHECK(dialog_manager); 90 CHECK(dialog_manager);
91 return dialog_manager; 91 return dialog_manager;
92 } 92 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698