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

Side by Side Diff: chrome/browser/ui/views/importer/import_lock_dialog_view.cc

Issue 2769383002: Firefox overlay is seen opened even if Import Overlay is Cancelled.
Patch Set: Firefox overlay is seen opened even if Import Overlay is Cancelled. Created 3 years, 9 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 "chrome/browser/ui/views/importer/import_lock_dialog_view.h" 5 #include "chrome/browser/ui/views/importer/import_lock_dialog_view.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 12 matching lines...) Expand all
23 using base::UserMetricsAction; 23 using base::UserMetricsAction;
24 24
25 namespace importer { 25 namespace importer {
26 26
27 void ShowImportLockDialog(gfx::NativeWindow parent, 27 void ShowImportLockDialog(gfx::NativeWindow parent,
28 const base::Callback<void(bool)>& callback) { 28 const base::Callback<void(bool)>& callback) {
29 ImportLockDialogView::Show(parent, callback); 29 ImportLockDialogView::Show(parent, callback);
30 content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown")); 30 content::RecordAction(UserMetricsAction("ImportLockDialogView_Shown"));
31 } 31 }
32 32
33 void HideImportLockDialog() {
34 ImportLockDialogView::Hide();
33 } // namespace importer 35 } // namespace importer
34 36
37 views::Widget* ImportLockDialogView::m_widget = NULL;
38
39 // static
40 void ImportLockDialogView::Hide() {
41 if (m_widget) {
42 m_widget->Hide();
43 m_widget->CloseNow();
44 }
45 }
46
35 // static 47 // static
36 void ImportLockDialogView::Show(gfx::NativeWindow parent, 48 void ImportLockDialogView::Show(gfx::NativeWindow parent,
37 const base::Callback<void(bool)>& callback) { 49 const base::Callback<void(bool)>& callback) {
38 views::DialogDelegate::CreateDialogWidget( 50 m_widget = views::DialogDelegate::CreateDialogWidget(
39 new ImportLockDialogView(callback), NULL, NULL)->Show(); 51 new ImportLockDialogView(callback), NULL, NULL);
52 m_widget->Show();
40 } 53 }
41 54
42 ImportLockDialogView::ImportLockDialogView( 55 ImportLockDialogView::ImportLockDialogView(
43 const base::Callback<void(bool)>& callback) 56 const base::Callback<void(bool)>& callback)
44 : description_label_(NULL), 57 : description_label_(NULL),
45 callback_(callback) { 58 callback_(callback) {
46 description_label_ = new views::Label( 59 description_label_ = new views::Label(
47 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); 60 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT));
48 description_label_->SetMultiLine(true); 61 description_label_->SetMultiLine(true);
49 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 62 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 94 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
82 base::Bind(callback_, true)); 95 base::Bind(callback_, true));
83 return true; 96 return true;
84 } 97 }
85 98
86 bool ImportLockDialogView::Cancel() { 99 bool ImportLockDialogView::Cancel() {
87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 100 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
88 base::Bind(callback_, false)); 101 base::Bind(callback_, false));
89 return true; 102 return true;
90 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698