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

Side by Side Diff: components/app_modal/app_modal_dialog.cc

Issue 2901583002: Fold AppModalDialog into its only subclass, JavaScriptAppModalDialog. (Closed)
Patch Set: fix collapse Created 3 years, 7 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
« no previous file with comments | « components/app_modal/app_modal_dialog.h ('k') | components/app_modal/app_modal_dialog_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/app_modal/app_modal_dialog.h"
6
7 #include "base/logging.h"
8 #include "base/run_loop.h"
9 #include "components/app_modal/app_modal_dialog_queue.h"
10 #include "components/app_modal/native_app_modal_dialog.h"
11
12 using content::WebContents;
13
14 namespace app_modal {
15 namespace {
16
17 AppModalDialogObserver* app_modal_dialog_observer = NULL;
18
19 } // namespace
20
21 AppModalDialogObserver::AppModalDialogObserver() {
22 DCHECK(!app_modal_dialog_observer);
23 app_modal_dialog_observer = this;
24 }
25
26 AppModalDialogObserver::~AppModalDialogObserver() {
27 DCHECK(app_modal_dialog_observer);
28 app_modal_dialog_observer = NULL;
29 }
30
31 AppModalDialog::AppModalDialog(WebContents* web_contents,
32 const base::string16& title)
33 : title_(title),
34 completed_(false),
35 valid_(true),
36 native_dialog_(NULL),
37 web_contents_(web_contents) {
38 }
39
40 AppModalDialog::~AppModalDialog() {
41 CompleteDialog();
42 }
43
44 void AppModalDialog::ShowModalDialog() {
45 native_dialog_ = CreateNativeDialog();
46 native_dialog_->ShowAppModalDialog();
47 if (app_modal_dialog_observer)
48 app_modal_dialog_observer->Notify(this);
49 }
50
51 bool AppModalDialog::IsValid() {
52 return valid_;
53 }
54
55 void AppModalDialog::Invalidate() {
56 valid_ = false;
57 }
58
59 bool AppModalDialog::IsJavaScriptModalDialog() {
60 return false;
61 }
62
63 void AppModalDialog::ActivateModalDialog() {
64 DCHECK(native_dialog_);
65 native_dialog_->ActivateAppModalDialog();
66 }
67
68 void AppModalDialog::CloseModalDialog() {
69 DCHECK(native_dialog_);
70 native_dialog_->CloseAppModalDialog();
71 }
72
73 void AppModalDialog::CompleteDialog() {
74 if (!completed_) {
75 completed_ = true;
76 AppModalDialogQueue::GetInstance()->ShowNextDialog();
77 }
78 }
79
80 } // namespace app_modal
OLDNEW
« no previous file with comments | « components/app_modal/app_modal_dialog.h ('k') | components/app_modal/app_modal_dialog_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698