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

Side by Side Diff: chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 <memory>
5 #include <set> 6 #include <set>
6 7
7 #include "base/macros.h" 8 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/platform_util.h" 9 #include "chrome/browser/platform_util.h"
10 #include "components/constrained_window/constrained_window_views.h" 10 #include "components/constrained_window/constrained_window_views.h"
11 #include "components/web_modal/single_web_contents_dialog_manager.h" 11 #include "components/web_modal/single_web_contents_dialog_manager.h"
12 #include "components/web_modal/web_contents_modal_dialog_host.h" 12 #include "components/web_modal/web_contents_modal_dialog_host.h"
13 #include "components/web_modal/web_contents_modal_dialog_manager.h" 13 #include "components/web_modal/web_contents_modal_dialog_manager.h"
14 #include "ui/gfx/geometry/point.h" 14 #include "ui/gfx/geometry/point.h"
15 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
16 #include "ui/views/border.h" 16 #include "ui/views/border.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 #include "ui/views/widget/widget_delegate.h" 18 #include "ui/views/widget/widget_delegate.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // SingleWebContentsDialogManager overrides 95 // SingleWebContentsDialogManager overrides
96 void Show() override { 96 void Show() override {
97 // The host destroying means the dialogs will be destroyed in short order. 97 // The host destroying means the dialogs will be destroyed in short order.
98 // Avoid showing dialogs at this point as the necessary native window 98 // Avoid showing dialogs at this point as the necessary native window
99 // services may not be present. 99 // services may not be present.
100 if (host_destroying_) 100 if (host_destroying_)
101 return; 101 return;
102 102
103 views::Widget* widget = GetWidget(dialog()); 103 views::Widget* widget = GetWidget(dialog());
104 #if defined(USE_AURA) 104 #if defined(USE_AURA)
105 scoped_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend; 105 std::unique_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend;
106 if (shown_widgets_.find(widget) != shown_widgets_.end()) { 106 if (shown_widgets_.find(widget) != shown_widgets_.end()) {
107 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations( 107 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations(
108 widget->GetNativeWindow()->parent())); 108 widget->GetNativeWindow()->parent()));
109 } 109 }
110 #endif 110 #endif
111 // Host may be NULL during tab drag on Views/Win32. 111 // Host may be NULL during tab drag on Views/Win32.
112 if (host_) 112 if (host_)
113 constrained_window::UpdateWebContentsModalDialogPosition(widget, host_); 113 constrained_window::UpdateWebContentsModalDialogPosition(widget, host_);
114 widget->Show(); 114 widget->Show();
115 Focus(); 115 Focus();
116 116
117 #if defined(USE_AURA) 117 #if defined(USE_AURA)
118 // TODO(pkotwicz): Control the z-order of the constrained dialog via 118 // TODO(pkotwicz): Control the z-order of the constrained dialog via
119 // views::kHostViewKey. We will need to ensure that the parent window's 119 // views::kHostViewKey. We will need to ensure that the parent window's
120 // shadows are below the constrained dialog in z-order when we do this. 120 // shadows are below the constrained dialog in z-order when we do this.
121 shown_widgets_.insert(widget); 121 shown_widgets_.insert(widget);
122 #endif 122 #endif
123 } 123 }
124 124
125 void Hide() override { 125 void Hide() override {
126 views::Widget* widget = GetWidget(dialog()); 126 views::Widget* widget = GetWidget(dialog());
127 #if defined(USE_AURA) 127 #if defined(USE_AURA)
128 scoped_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend; 128 std::unique_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend;
129 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations( 129 suspend.reset(new wm::SuspendChildWindowVisibilityAnimations(
130 widget->GetNativeWindow()->parent())); 130 widget->GetNativeWindow()->parent()));
131 #endif 131 #endif
132 widget->Hide(); 132 widget->Hide();
133 } 133 }
134 134
135 void Close() override { GetWidget(dialog())->Close(); } 135 void Close() override { GetWidget(dialog())->Close(); }
136 136
137 void Focus() override { 137 void Focus() override {
138 views::Widget* widget = GetWidget(dialog()); 138 views::Widget* widget = GetWidget(dialog());
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 namespace web_modal { 246 namespace web_modal {
247 247
248 SingleWebContentsDialogManager* 248 SingleWebContentsDialogManager*
249 WebContentsModalDialogManager::CreateNativeWebModalManager( 249 WebContentsModalDialogManager::CreateNativeWebModalManager(
250 gfx::NativeWindow dialog, 250 gfx::NativeWindow dialog,
251 SingleWebContentsDialogManagerDelegate* native_delegate) { 251 SingleWebContentsDialogManagerDelegate* native_delegate) {
252 return new NativeWebContentsModalDialogManagerViews(dialog, native_delegate); 252 return new NativeWebContentsModalDialogManagerViews(dialog, native_delegate);
253 } 253 }
254 254
255 } // namespace web_modal 255 } // namespace web_modal
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/uninstall_view.h ('k') | chrome/browser/ui/views/website_settings/chooser_bubble_ui_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698