Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ | 5 #ifndef CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ |
| 6 #define CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ | 6 #define CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 class GlobalErrorBubbleViewBase; | 15 class GlobalErrorBubbleViewBase; |
| 16 | 16 |
| 17 namespace gfx { | |
| 18 class Image; | |
| 19 } | |
| 20 | |
| 17 // This object describes a single global error. | 21 // This object describes a single global error. |
| 18 class GlobalError : public base::SupportsWeakPtr<GlobalError> { | 22 class GlobalError : public base::SupportsWeakPtr<GlobalError> { |
| 19 public: | 23 public: |
| 20 enum Severity { | 24 enum Severity { |
| 21 SEVERITY_LOW, | 25 SEVERITY_LOW, |
| 22 SEVERITY_MEDIUM, | 26 SEVERITY_MEDIUM, |
| 23 SEVERITY_HIGH, | 27 SEVERITY_HIGH, |
| 24 }; | 28 }; |
| 25 | 29 |
| 26 GlobalError(); | 30 GlobalError(); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 43 virtual void ExecuteMenuItem(Browser* browser) = 0; | 47 virtual void ExecuteMenuItem(Browser* browser) = 0; |
| 44 | 48 |
| 45 // Returns true if a bubble view should be shown. | 49 // Returns true if a bubble view should be shown. |
| 46 virtual bool HasBubbleView() = 0; | 50 virtual bool HasBubbleView() = 0; |
| 47 // Returns true if the bubble view has been shown. | 51 // Returns true if the bubble view has been shown. |
| 48 virtual bool HasShownBubbleView(); | 52 virtual bool HasShownBubbleView(); |
| 49 // Called to show the bubble view. | 53 // Called to show the bubble view. |
| 50 void ShowBubbleView(Browser* browser); | 54 void ShowBubbleView(Browser* browser); |
| 51 // Returns the bubble view. | 55 // Returns the bubble view. |
| 52 virtual GlobalErrorBubbleViewBase* GetBubbleView(); | 56 virtual GlobalErrorBubbleViewBase* GetBubbleView(); |
| 57 // Returns a custom icon to use for the bubble view. If NULL, the | |
| 58 // bubble view uses GetBubbleViewIconResourceID instead. | |
| 59 virtual gfx::Image* GetBubbleViewCustomIcon(); | |
|
sail
2013/05/24 22:15:02
Return by value instead. Callers can use IsEmpty()
Yoyo Zhou
2013/05/28 21:58:02
Done.
| |
| 53 // Returns the resource ID for bubble view icon. | 60 // Returns the resource ID for bubble view icon. |
| 54 int GetBubbleViewIconResourceID(); | 61 int GetBubbleViewIconResourceID(); |
|
sail
2013/05/24 22:15:02
this should be removed.
Yoyo Zhou
2013/05/28 18:21:34
What do you think about making it a static GetDefa
sail
2013/05/28 18:39:50
I think it's best to just have a simple API. I don
Yoyo Zhou
2013/05/28 21:58:02
OK. I changed the API to gfx::Image GetBubbleViewI
| |
| 55 // Returns the title for the bubble view. | 62 // Returns the title for the bubble view. |
| 56 virtual string16 GetBubbleViewTitle() = 0; | 63 virtual string16 GetBubbleViewTitle() = 0; |
| 57 // Returns the messages for the bubble view, one per line. Multiple messages | 64 // Returns the messages for the bubble view, one per line. Multiple messages |
| 58 // are only supported on Views. | 65 // are only supported on Views. |
| 59 // TODO(yoz): Add multi-line support for GTK and Cocoa. | 66 // TODO(yoz): Add multi-line support for GTK and Cocoa. |
| 60 virtual std::vector<string16> GetBubbleViewMessages() = 0; | 67 virtual std::vector<string16> GetBubbleViewMessages() = 0; |
| 61 // Returns the accept button label for the bubble view. | 68 // Returns the accept button label for the bubble view. |
| 62 virtual string16 GetBubbleViewAcceptButtonLabel() = 0; | 69 virtual string16 GetBubbleViewAcceptButtonLabel() = 0; |
| 63 // Returns the cancel button label for the bubble view. To hide the cancel | 70 // Returns the cancel button label for the bubble view. To hide the cancel |
| 64 // button return an empty string. | 71 // button return an empty string. |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 78 | 85 |
| 79 | 86 |
| 80 private: | 87 private: |
| 81 bool has_shown_bubble_view_; | 88 bool has_shown_bubble_view_; |
| 82 GlobalErrorBubbleViewBase* bubble_view_; | 89 GlobalErrorBubbleViewBase* bubble_view_; |
| 83 | 90 |
| 84 DISALLOW_COPY_AND_ASSIGN(GlobalError); | 91 DISALLOW_COPY_AND_ASSIGN(GlobalError); |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 #endif // CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ | 94 #endif // CHROME_BROWSER_UI_GLOBAL_ERROR_GLOBAL_ERROR_H_ |
| OLD | NEW |