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

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: Fixed the Review Comments 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() {
Ilya Sherman 2017/03/27 15:21:52 You'll need to also implement this method for Mac,
nikhil.sahni 2017/03/28 11:22:00 Hi Ilya Sherman, Thanks for pointing this out , I
34 ImportLockDialogView::Hide();
35 }
36
33 } // namespace importer 37 } // namespace importer
34 38
39 views::Widget* ImportLockDialogView::m_widget = NULL;
Ilya Sherman 2017/03/27 15:21:52 nit: s/NULL/nullptr
nikhil.sahni 2017/03/28 11:22:00 Done.
40
41 // static
42 void ImportLockDialogView::Hide() {
43 if (m_widget) {
Ilya Sherman 2017/03/27 15:21:52 It looks like the widget can be destroyed without
nikhil.sahni 2017/03/28 11:22:00 Here I guess there won't be any issue as even if i
Ilya Sherman 2017/03/29 06:29:02 At a minimum, you'll want to reset g_widget to nul
nikhil.sahni 2017/03/30 12:13:35 yes you are right this case needs to be handled, b
44 m_widget->Hide();
45 m_widget->CloseNow();
Ilya Sherman 2017/03/27 15:21:52 Hmm, is it actually necessary to call both of thes
nikhil.sahni 2017/03/28 11:22:00 Done.
46 }
47 }
48
35 // static 49 // static
36 void ImportLockDialogView::Show(gfx::NativeWindow parent, 50 void ImportLockDialogView::Show(gfx::NativeWindow parent,
37 const base::Callback<void(bool)>& callback) { 51 const base::Callback<void(bool)>& callback) {
38 views::DialogDelegate::CreateDialogWidget( 52 m_widget = views::DialogDelegate::CreateDialogWidget(
39 new ImportLockDialogView(callback), NULL, NULL)->Show(); 53 new ImportLockDialogView(callback), NULL, NULL);
54 m_widget->Show();
40 } 55 }
41 56
42 ImportLockDialogView::ImportLockDialogView( 57 ImportLockDialogView::ImportLockDialogView(
43 const base::Callback<void(bool)>& callback) 58 const base::Callback<void(bool)>& callback)
44 : description_label_(NULL), 59 : description_label_(NULL),
45 callback_(callback) { 60 callback_(callback) {
46 description_label_ = new views::Label( 61 description_label_ = new views::Label(
47 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)); 62 l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT));
48 description_label_->SetMultiLine(true); 63 description_label_->SetMultiLine(true);
49 description_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 64 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, 96 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
82 base::Bind(callback_, true)); 97 base::Bind(callback_, true));
83 return true; 98 return true;
84 } 99 }
85 100
86 bool ImportLockDialogView::Cancel() { 101 bool ImportLockDialogView::Cancel() {
87 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 102 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
88 base::Bind(callback_, false)); 103 base::Bind(callback_, false));
89 return true; 104 return true;
90 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698