| OLD | NEW |
| 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 "chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_
views.h" | 5 #include "chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_
views.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" | 7 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" |
| 8 #include "components/web_modal/web_contents_modal_dialog_host.h" | 8 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 9 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 | 266 |
| 267 void MediaGalleriesScanResultDialogViews::ShowContextMenu( | 267 void MediaGalleriesScanResultDialogViews::ShowContextMenu( |
| 268 const gfx::Point& point, | 268 const gfx::Point& point, |
| 269 ui::MenuSourceType source_type, | 269 ui::MenuSourceType source_type, |
| 270 MediaGalleryPrefId id) { | 270 MediaGalleryPrefId id) { |
| 271 context_menu_runner_.reset(new views::MenuRunner( | 271 context_menu_runner_.reset(new views::MenuRunner( |
| 272 controller_->GetContextMenu(id))); | 272 controller_->GetContextMenu(id))); |
| 273 | 273 |
| 274 if (context_menu_runner_->RunMenuAt( | 274 if (context_menu_runner_->RunMenuAt( |
| 275 GetWidget(), NULL, gfx::Rect(point.x(), point.y(), 0, 0), | 275 GetWidget(), |
| 276 views::MenuItemView::TOPLEFT, source_type, | 276 NULL, |
| 277 gfx::Rect(point.x(), point.y(), 0, 0), |
| 278 ui::MENU_ANCHOR_TOPLEFT, |
| 279 source_type, |
| 277 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == | 280 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU) == |
| 278 views::MenuRunner::MENU_DELETED) { | 281 views::MenuRunner::MENU_DELETED) { |
| 279 return; | 282 return; |
| 280 } | 283 } |
| 281 } | 284 } |
| 282 | 285 |
| 283 void MediaGalleriesScanResultDialogViews::AcceptDialogForTesting() { | 286 void MediaGalleriesScanResultDialogViews::AcceptDialogForTesting() { |
| 284 accepted_ = true; | 287 accepted_ = true; |
| 285 | 288 |
| 286 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = | 289 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 287 web_modal::WebContentsModalDialogManager::FromWebContents( | 290 web_modal::WebContentsModalDialogManager::FromWebContents( |
| 288 controller_->web_contents()); | 291 controller_->web_contents()); |
| 289 DCHECK(web_contents_modal_dialog_manager); | 292 DCHECK(web_contents_modal_dialog_manager); |
| 290 web_modal::WebContentsModalDialogManager::TestApi( | 293 web_modal::WebContentsModalDialogManager::TestApi( |
| 291 web_contents_modal_dialog_manager).CloseAllDialogs(); | 294 web_contents_modal_dialog_manager).CloseAllDialogs(); |
| 292 } | 295 } |
| 293 | 296 |
| 294 // MediaGalleriesScanResultDialogViewsController ------------------------------- | 297 // MediaGalleriesScanResultDialogViewsController ------------------------------- |
| 295 | 298 |
| 296 // static | 299 // static |
| 297 MediaGalleriesScanResultDialog* MediaGalleriesScanResultDialog::Create( | 300 MediaGalleriesScanResultDialog* MediaGalleriesScanResultDialog::Create( |
| 298 MediaGalleriesScanResultDialogController* controller) { | 301 MediaGalleriesScanResultDialogController* controller) { |
| 299 return new MediaGalleriesScanResultDialogViews(controller); | 302 return new MediaGalleriesScanResultDialogViews(controller); |
| 300 } | 303 } |
| OLD | NEW |