OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_BROWSER_UI_SAD_TAB_H_ | 5 #ifndef CHROME_BROWSER_UI_SAD_TAB_H_ |
6 #define CHROME_BROWSER_UI_SAD_TAB_H_ | 6 #define CHROME_BROWSER_UI_SAD_TAB_H_ |
7 | 7 |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "chrome/browser/ui/sad_tab_types.h" | 9 #include "chrome/browser/ui/sad_tab_types.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 class WebContents; | 12 class WebContents; |
13 } | 13 } |
14 | 14 |
15 namespace chrome { | 15 namespace chrome { |
16 | 16 |
17 // Cross-platform interface to show the Sad tab UI. | 17 // Cross-platform interface to show the Sad tab UI. |
18 class SadTab { | 18 class SadTab { |
19 public: | 19 public: |
20 enum class Action { | |
21 BUTTON, | |
22 HELP_LINK, | |
23 }; | |
24 | |
20 // Factory function to create the platform specific implementations. | 25 // Factory function to create the platform specific implementations. |
21 static SadTab* Create(content::WebContents* web_contents, SadTabKind kind); | 26 static SadTab* Create(content::WebContents* web_contents, SadTabKind kind); |
22 | 27 |
23 // Returns true if the sad tab should be shown. | 28 // Returns true if the sad tab should be shown. |
24 static bool ShouldShow(base::TerminationStatus status); | 29 static bool ShouldShow(base::TerminationStatus status); |
25 | 30 |
26 virtual ~SadTab() {} | 31 virtual ~SadTab() {} |
27 | 32 |
28 // Shows the Sad tab. | 33 int GetTitle(); |
James Cook
2016/09/08 20:15:50
nit: Document these functions, especially what the
Sidney San Martín
2016/09/09 01:36:00
Done, let me know how these comments look.
James Cook
2016/09/09 04:37:09
Very helpful, especially the note that they vary.
| |
29 virtual void Show() = 0; | 34 int GetMessage(); |
35 int GetButtonTitle(); | |
36 int GetHelpLinkTitle(); | |
37 const char* GetHelpLinkURL(); | |
30 | 38 |
31 // Closes the Sad tab. | 39 // Virtual for testing. |
32 virtual void Close() = 0; | 40 virtual void RecordFirstPaint(); |
41 virtual void PerformAction(Action); | |
42 | |
43 protected: | |
44 SadTab(content::WebContents* web_contents, SadTabKind kind); | |
45 | |
46 private: | |
47 content::WebContents* web_contents_; | |
48 SadTabKind kind_; | |
49 bool want_feedback_; | |
James Cook
2016/09/08 20:15:50
nit: Document and/or rename. Who wants feedback ab
Sidney San Martín
2016/09/09 01:36:00
We, the developers, want feedback about what cause
| |
50 | |
51 #if DCHECK_IS_ON() | |
James Cook
2016/09/08 20:15:50
Does this need #if guards? Is it for unused variab
Sidney San Martín
2016/09/09 01:36:00
Huh, I thought it improved readability: you're all
James Cook
2016/09/09 04:37:09
I found it harder to read. Frankly, I've been in t
Sidney San Martín
2016/09/09 15:39:44
Done. I also find it strange that this is a macro
Sidney San Martín
2016/09/09 15:39:44
Done. recorded_paint_ always starts false, and sho
Nico
2016/09/09 15:45:30
FWIW this is because if it were a macro and you fo
Sidney San Martín
2016/09/09 15:47:18
Ah, thanks. That makes sense.
| |
52 bool recorded_paint_ = false; | |
53 #endif | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(SadTab); | |
33 }; | 56 }; |
34 | 57 |
35 } // namespace chrome | 58 } // namespace chrome |
36 | 59 |
37 #endif // CHROME_BROWSER_UI_SAD_TAB_H_ | 60 #endif // CHROME_BROWSER_UI_SAD_TAB_H_ |
OLD | NEW |