| OLD | NEW |
| 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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/frame/custom_frame_view_ash.h" | 10 #include "ash/frame/custom_frame_view_ash.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 views::View::ConvertPointFromScreen(widget()->non_client_view(), | 268 views::View::ConvertPointFromScreen(widget()->non_client_view(), |
| 269 &point_in_view_coords); | 269 &point_in_view_coords); |
| 270 int hit_test = | 270 int hit_test = |
| 271 widget()->non_client_view()->NonClientHitTest(point_in_view_coords); | 271 widget()->non_client_view()->NonClientHitTest(point_in_view_coords); |
| 272 if (hit_test == HTCAPTION) { | 272 if (hit_test == HTCAPTION) { |
| 273 menu_model_adapter_.reset(new views::MenuModelAdapter( | 273 menu_model_adapter_.reset(new views::MenuModelAdapter( |
| 274 menu_model_.get(), | 274 menu_model_.get(), |
| 275 base::Bind(&ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed, | 275 base::Bind(&ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed, |
| 276 base::Unretained(this)))); | 276 base::Unretained(this)))); |
| 277 menu_runner_.reset(new views::MenuRunner( | 277 menu_runner_.reset(new views::MenuRunner( |
| 278 menu_model_adapter_->CreateMenu(), views::MenuRunner::HAS_MNEMONICS | | 278 menu_model_adapter_->CreateMenu(), |
| 279 views::MenuRunner::CONTEXT_MENU | | 279 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU)); |
| 280 views::MenuRunner::ASYNC)); | |
| 281 menu_runner_->RunMenuAt(source->GetWidget(), NULL, | 280 menu_runner_->RunMenuAt(source->GetWidget(), NULL, |
| 282 gfx::Rect(p, gfx::Size(0, 0)), | 281 gfx::Rect(p, gfx::Size(0, 0)), |
| 283 views::MENU_ANCHOR_TOPLEFT, source_type); | 282 views::MENU_ANCHOR_TOPLEFT, source_type); |
| 284 } else { | 283 } else { |
| 285 menu_model_.reset(); | 284 menu_model_.reset(); |
| 286 } | 285 } |
| 287 } | 286 } |
| 288 | 287 |
| 289 views::NonClientFrameView* | 288 views::NonClientFrameView* |
| 290 ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView( | 289 ChromeNativeAppWindowViewsAuraAsh::CreateNonClientFrameView( |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 window_tree_host->SetClientArea(insets, | 373 window_tree_host->SetClientArea(insets, |
| 375 std::move(additional_client_regions)); | 374 std::move(additional_client_regions)); |
| 376 } | 375 } |
| 377 } | 376 } |
| 378 | 377 |
| 379 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { | 378 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { |
| 380 menu_runner_.reset(); | 379 menu_runner_.reset(); |
| 381 menu_model_adapter_.reset(); | 380 menu_model_adapter_.reset(); |
| 382 menu_model_.reset(); | 381 menu_model_.reset(); |
| 383 } | 382 } |
| OLD | NEW |