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

Side by Side Diff: chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "components/web_modal/web_contents_modal_dialog_manager.h" 5 #include "components/web_modal/web_contents_modal_dialog_manager.h"
6 6
7 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" 7 #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
8 #include "components/web_modal/single_web_contents_dialog_manager.h" 8 #include "components/web_modal/single_web_contents_dialog_manager.h"
9 9
10 using web_modal::NativeWebContentsModalDialog; 10 using web_modal::NativeWebContentsModalDialog;
11 11
12 namespace { 12 namespace {
13 13
14 class NativeWebContentsModalDialogManagerCocoa 14 class NativeWebContentsModalDialogManagerCocoa
15 : public web_modal::SingleWebContentsDialogManager { 15 : public web_modal::SingleWebContentsDialogManager {
16 public: 16 public:
17 NativeWebContentsModalDialogManagerCocoa( 17 NativeWebContentsModalDialogManagerCocoa(
18 NativeWebContentsModalDialog dialog) 18 NativeWebContentsModalDialog dialog)
19 : dialog_(dialog) { 19 : dialog_(dialog) {
20 } 20 }
21 21
22 virtual ~NativeWebContentsModalDialogManagerCocoa() { 22 ~NativeWebContentsModalDialogManagerCocoa() override {}
23 }
24 23
25 // SingleWebContentsDialogManager overrides 24 // SingleWebContentsDialogManager overrides
26 virtual void Show() override { 25 void Show() override {
27 GetConstrainedWindowMac(dialog())->ShowWebContentsModalDialog(); 26 GetConstrainedWindowMac(dialog())->ShowWebContentsModalDialog();
28 } 27 }
29 28
30 virtual void Hide() override { 29 void Hide() override {}
31 }
32 30
33 virtual void Close() override { 31 void Close() override {
34 GetConstrainedWindowMac(dialog())->CloseWebContentsModalDialog(); 32 GetConstrainedWindowMac(dialog())->CloseWebContentsModalDialog();
35 } 33 }
36 34
37 virtual void Focus() override { 35 void Focus() override {
38 GetConstrainedWindowMac(dialog())->FocusWebContentsModalDialog(); 36 GetConstrainedWindowMac(dialog())->FocusWebContentsModalDialog();
39 } 37 }
40 38
41 virtual void Pulse() override { 39 void Pulse() override {
42 GetConstrainedWindowMac(dialog())->PulseWebContentsModalDialog(); 40 GetConstrainedWindowMac(dialog())->PulseWebContentsModalDialog();
43 } 41 }
44 42
45 virtual void HostChanged( 43 void HostChanged(web_modal::WebContentsModalDialogHost* new_host) override {}
46 web_modal::WebContentsModalDialogHost* new_host) override {
47 }
48 44
49 virtual NativeWebContentsModalDialog dialog() override { 45 NativeWebContentsModalDialog dialog() override { return dialog_; }
50 return dialog_;
51 }
52 46
53 private: 47 private:
54 static ConstrainedWindowMac* GetConstrainedWindowMac( 48 static ConstrainedWindowMac* GetConstrainedWindowMac(
55 NativeWebContentsModalDialog dialog) { 49 NativeWebContentsModalDialog dialog) {
56 return static_cast<ConstrainedWindowMac*>(dialog); 50 return static_cast<ConstrainedWindowMac*>(dialog);
57 } 51 }
58 52
59 // In mac this is a pointer to a ConstrainedWindowMac. 53 // In mac this is a pointer to a ConstrainedWindowMac.
60 // TODO(gbillock): Replace this casting system with a more typesafe call path. 54 // TODO(gbillock): Replace this casting system with a more typesafe call path.
61 NativeWebContentsModalDialog dialog_; 55 NativeWebContentsModalDialog dialog_;
62 56
63 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerCocoa); 57 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerCocoa);
64 }; 58 };
65 59
66 } // namespace 60 } // namespace
67 61
68 namespace web_modal { 62 namespace web_modal {
69 63
70 SingleWebContentsDialogManager* 64 SingleWebContentsDialogManager*
71 WebContentsModalDialogManager::CreateNativeWebModalManager( 65 WebContentsModalDialogManager::CreateNativeWebModalManager(
72 NativeWebContentsModalDialog dialog, 66 NativeWebContentsModalDialog dialog,
73 SingleWebContentsDialogManagerDelegate* native_delegate) { 67 SingleWebContentsDialogManagerDelegate* native_delegate) {
74 return new NativeWebContentsModalDialogManagerCocoa(dialog); 68 return new NativeWebContentsModalDialogManagerCocoa(dialog);
75 } 69 }
76 70
77 } // namespace web_modal 71 } // namespace web_modal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698