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"
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
{
24 BUTTON_CANCEL
= 1 << 1,
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
53 virtual base::string16
GetLinkText() const;
55 // Called when the Link is clicked.
56 virtual void LinkClicked();
59 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleModel
);
62 #endif // CHROME_BROWSER_UI_CONFIRM_BUBBLE_MODEL_H_