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

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/apps/chrome_native_app_window_views_aura_ash.h " 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.h "
6 6
7 #include "apps/ui/views/app_window_frame_view.h" 7 #include "apps/ui/views/app_window_frame_view.h"
8 #include "ash/ash_constants.h" 8 #include "ash/ash_constants.h"
9 #include "ash/frame/custom_frame_view_ash.h" 9 #include "ash/frame/custom_frame_view_ash.h"
10 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return 216 return
217 ash::wm::GetWindowState(widget()->GetNativeWindow())->panel_attached(); 217 ash::wm::GetWindowState(widget()->GetNativeWindow())->panel_attached();
218 } 218 }
219 return widget()->IsAlwaysOnTop(); 219 return widget()->IsAlwaysOnTop();
220 } 220 }
221 221
222 void ChromeNativeAppWindowViewsAuraAsh::ShowContextMenuForView( 222 void ChromeNativeAppWindowViewsAuraAsh::ShowContextMenuForView(
223 views::View* source, 223 views::View* source,
224 const gfx::Point& p, 224 const gfx::Point& p,
225 ui::MenuSourceType source_type) { 225 ui::MenuSourceType source_type) {
226 scoped_ptr<ui::MenuModel> model = 226 std::unique_ptr<ui::MenuModel> model =
227 CreateMultiUserContextMenu(app_window()->GetNativeWindow()); 227 CreateMultiUserContextMenu(app_window()->GetNativeWindow());
228 if (!model.get()) 228 if (!model.get())
229 return; 229 return;
230 230
231 // Only show context menu if point is in caption. 231 // Only show context menu if point is in caption.
232 gfx::Point point_in_view_coords(p); 232 gfx::Point point_in_view_coords(p);
233 views::View::ConvertPointFromScreen(widget()->non_client_view(), 233 views::View::ConvertPointFromScreen(widget()->non_client_view(),
234 &point_in_view_coords); 234 &point_in_view_coords);
235 int hit_test = 235 int hit_test =
236 widget()->non_client_view()->NonClientHitTest(point_in_view_coords); 236 widget()->non_client_view()->NonClientHitTest(point_in_view_coords);
237 if (hit_test == HTCAPTION) { 237 if (hit_test == HTCAPTION) {
238 menu_runner_.reset(new views::MenuRunner( 238 menu_runner_.reset(new views::MenuRunner(
239 model.get(), 239 model.get(),
240 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); 240 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
241 if (menu_runner_->RunMenuAt(source->GetWidget(), NULL, 241 if (menu_runner_->RunMenuAt(source->GetWidget(), NULL,
242 gfx::Rect(p, gfx::Size(0, 0)), 242 gfx::Rect(p, gfx::Size(0, 0)),
243 views::MENU_ANCHOR_TOPLEFT, source_type) == 243 views::MENU_ANCHOR_TOPLEFT, source_type) ==
244 views::MenuRunner::MENU_DELETED) { 244 views::MenuRunner::MENU_DELETED) {
245 return; 245 return;
246 } 246 }
247 } 247 }
248 } 248 }
249 249
250 views::NonClientFrameView* 250 views::NonClientFrameView*
251 ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView( 251 ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView(
252 views::Widget* widget) { 252 views::Widget* widget) {
253 // Set the delegate now because CustomFrameViewAsh sets the 253 // Set the delegate now because CustomFrameViewAsh sets the
254 // WindowStateDelegate if one is not already set. 254 // WindowStateDelegate if one is not already set.
255 ash::wm::GetWindowState(GetNativeWindow()) 255 ash::wm::GetWindowState(GetNativeWindow())
256 ->SetDelegate(scoped_ptr<ash::wm::WindowStateDelegate>( 256 ->SetDelegate(std::unique_ptr<ash::wm::WindowStateDelegate>(
257 new NativeAppWindowStateDelegate(app_window(), this))); 257 new NativeAppWindowStateDelegate(app_window(), this)));
258 258
259 if (IsFrameless()) 259 if (IsFrameless())
260 return CreateNonStandardAppFrame(); 260 return CreateNonStandardAppFrame();
261 261
262 if (app_window()->window_type_is_panel()) { 262 if (app_window()->window_type_is_panel()) {
263 ash::PanelFrameView* frame_view = 263 ash::PanelFrameView* frame_view =
264 new ash::PanelFrameView(widget, ash::PanelFrameView::FRAME_ASH); 264 new ash::PanelFrameView(widget, ash::PanelFrameView::FRAME_ASH);
265 frame_view->set_context_menu_controller(this); 265 frame_view->set_context_menu_controller(this);
266 if (HasFrameColor()) 266 if (HasFrameColor())
267 frame_view->SetFrameColors(ActiveFrameColor(), InactiveFrameColor()); 267 frame_view->SetFrameColors(ActiveFrameColor(), InactiveFrameColor());
(...skipping 29 matching lines...) Expand all
297 // Autohide the shelf instead of hiding the shelf completely when only in 297 // Autohide the shelf instead of hiding the shelf completely when only in
298 // OS fullscreen. 298 // OS fullscreen.
299 ash::wm::WindowState* window_state = 299 ash::wm::WindowState* window_state =
300 ash::wm::GetWindowState(widget()->GetNativeWindow()); 300 ash::wm::GetWindowState(widget()->GetNativeWindow());
301 window_state->set_hide_shelf_when_fullscreen(fullscreen_types != 301 window_state->set_hide_shelf_when_fullscreen(fullscreen_types !=
302 AppWindow::FULLSCREEN_TYPE_OS); 302 AppWindow::FULLSCREEN_TYPE_OS);
303 DCHECK(ash::Shell::HasInstance()); 303 DCHECK(ash::Shell::HasInstance());
304 ash::Shell::GetInstance()->UpdateShelfVisibility(); 304 ash::Shell::GetInstance()->UpdateShelfVisibility();
305 } 305 }
306 } 306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698