ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / ui / confirm_bubble_model.h
blob3406016c7de0276c755c7f9e77e323fd52de91a3
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_CONFIRM_BUBBLE_MODEL_H_
6 #define CHROME_BROWSER_UI_CONFIRM_BUBBLE_MODEL_H_
8 #include "base/basictypes.h"
9 #include "base/strings/string16.h"
11 namespace gfx {
12 class Image;
15 // An interface implemented by objects wishing to control an ConfirmBubbleView.
16 // To use this class to implement a bubble menu, we need two steps:
17 // 1. Implement a class derived from this class.
18 // 2. Call chrome::ShowConfirmBubble() with the class implemented in 1.
19 class ConfirmBubbleModel {
20 public:
21 enum BubbleButton {
22 BUTTON_NONE = 0,
23 BUTTON_OK = 1 << 0,
24 BUTTON_CANCEL = 1 << 1,
27 ConfirmBubbleModel();
28 virtual ~ConfirmBubbleModel();
30 // Returns the title string and the message string to be displayed for this
31 // bubble menu. These must not be empty strings.
32 virtual base::string16 GetTitle() const = 0;
33 virtual base::string16 GetMessageText() const = 0;
35 // Return the buttons to be shown for this bubble menu. This function returns
36 // a combination of BubbleButton values, e.g. when we show both an OK button
37 // and a cancel button, it should return (BUTTON_OK | BUTTON_CANCEL). (This is
38 // the default implementation.)
39 virtual int GetButtons() const;
41 // Return the label for the specified button. The default implementation
42 // returns "OK" for the OK button and "Cancel" for the Cancel button.
43 virtual base::string16 GetButtonLabel(BubbleButton button) const;
45 // Called when the OK button is pressed.
46 virtual void Accept();
48 // Called when the Cancel button is pressed.
49 virtual void Cancel();
51 // Returns the text of the link to be displayed, if any. Otherwise returns
52 // and empty string.
53 virtual base::string16 GetLinkText() const;
55 // Called when the Link is clicked.
56 virtual void LinkClicked();
58 private:
59 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleModel);
62 #endif // CHROME_BROWSER_UI_CONFIRM_BUBBLE_MODEL_H_