| OLD | NEW |
| 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/views/extensions/media_galleries_dialog_views.h" | 5 #include "chrome/browser/ui/views/extensions/media_galleries_dialog_views.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" | 8 #include "chrome/browser/ui/views/extensions/media_gallery_checkbox_view.h" |
| 9 #include "components/web_modal/web_contents_modal_dialog_host.h" | 9 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 10 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 web_contents_modal_dialog_manager->ShowModalDialog( | 88 web_contents_modal_dialog_manager->ShowModalDialog( |
| 89 window_->GetNativeView()); | 89 window_->GetNativeView()); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 MediaGalleriesDialogViews::~MediaGalleriesDialogViews() { | 93 MediaGalleriesDialogViews::~MediaGalleriesDialogViews() { |
| 94 if (!ControllerHasWebContents()) | 94 if (!ControllerHasWebContents()) |
| 95 delete contents_; | 95 delete contents_; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void MediaGalleriesDialogViews::AcceptDialogForTesting() { |
| 99 accepted_ = true; |
| 100 |
| 101 web_modal::WebContentsModalDialogManager* web_contents_modal_dialog_manager = |
| 102 web_modal::WebContentsModalDialogManager::FromWebContents( |
| 103 controller_->WebContents()); |
| 104 DCHECK(web_contents_modal_dialog_manager); |
| 105 web_modal::WebContentsModalDialogManager::TestApi( |
| 106 web_contents_modal_dialog_manager).CloseAllDialogs(); |
| 107 } |
| 108 |
| 98 void MediaGalleriesDialogViews::InitChildViews() { | 109 void MediaGalleriesDialogViews::InitChildViews() { |
| 99 // Outer dialog layout. | 110 // Outer dialog layout. |
| 100 contents_->RemoveAllChildViews(true); | 111 contents_->RemoveAllChildViews(true); |
| 101 checkbox_map_.clear(); | 112 checkbox_map_.clear(); |
| 102 | 113 |
| 103 int dialog_content_width = views::Widget::GetLocalizedContentsWidth( | 114 int dialog_content_width = views::Widget::GetLocalizedContentsWidth( |
| 104 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS); | 115 IDS_MEDIA_GALLERIES_DIALOG_CONTENT_WIDTH_CHARS); |
| 105 views::GridLayout* layout = views::GridLayout::CreatePanel(contents_); | 116 views::GridLayout* layout = views::GridLayout::CreatePanel(contents_); |
| 106 contents_->SetLayoutManager(layout); | 117 contents_->SetLayoutManager(layout); |
| 107 | 118 |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 return controller_->WebContents() != NULL; | 352 return controller_->WebContents() != NULL; |
| 342 } | 353 } |
| 343 | 354 |
| 344 // MediaGalleriesDialogViewsController ----------------------------------------- | 355 // MediaGalleriesDialogViewsController ----------------------------------------- |
| 345 | 356 |
| 346 // static | 357 // static |
| 347 MediaGalleriesDialog* MediaGalleriesDialog::Create( | 358 MediaGalleriesDialog* MediaGalleriesDialog::Create( |
| 348 MediaGalleriesDialogController* controller) { | 359 MediaGalleriesDialogController* controller) { |
| 349 return new MediaGalleriesDialogViews(controller); | 360 return new MediaGalleriesDialogViews(controller); |
| 350 } | 361 } |
| OLD | NEW |