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

Side by Side Diff: chrome/browser/ui/views/confirm_bubble_view.h

Issue 8746001: Rebase ConfirmBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restore the ConfirmBubbleModel::Show NativeView argument. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_VIEWS_CONFIRM_BUBBLE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/views/bubble/bubble.h" 11 #include "ui/views/bubble/bubble_delegate.h"
12 #include "ui/views/controls/button/button.h" 12 #include "ui/views/controls/button/button.h"
13 #include "ui/views/controls/link_listener.h" 13 #include "ui/views/controls/link_listener.h"
14 #include "views/view.h"
15 14
16 class ConfirmBubbleModel; 15 class ConfirmBubbleModel;
17 16
18 // A class that implements a bubble that consists of the following items: 17 // A class that implements a bubble that consists of the following items:
19 // * one icon ("icon") 18 // * one icon ("icon")
20 // * one title text ("title") 19 // * one title text ("title")
21 // * one message text ("message") 20 // * one message text ("message")
22 // * one optional link ("link") 21 // * one optional link ("link")
23 // * two optional buttons ("ok" and "cancel") 22 // * two optional buttons ("ok" and "cancel")
24 // 23 //
25 // This bubble is convenient when we wish to ask transient, non-blocking 24 // This bubble is convenient when we wish to ask transient, non-blocking
26 // questions. Unlike a dialog, a bubble menu disappears when we click outside of 25 // questions. Unlike a dialog, a bubble menu disappears when we click outside of
27 // its window to avoid blocking user operations. A bubble is laid out as 26 // its window to avoid blocking user operations. A bubble is laid out as
28 // follows: 27 // follows:
29 // 28 //
30 // +------------------------+ 29 // +------------------------+
31 // | icon title x | 30 // | icon title x |
32 // | message | 31 // | message |
33 // | link | 32 // | link |
34 // | [OK] [Cancel] | 33 // | [OK] [Cancel] |
35 // +------------------------+ 34 // +------------------------+
36 // 35 //
37 class ConfirmBubbleView : public BubbleDelegate, 36 class ConfirmBubbleView : public views::BubbleDelegateView,
38 public views::ButtonListener, 37 public views::ButtonListener,
39 public views::LinkListener, 38 public views::LinkListener {
40 public views::View {
41 public: 39 public:
42 explicit ConfirmBubbleView(ConfirmBubbleModel* model); 40 explicit ConfirmBubbleView(const gfx::Point& anchor_point,
41 ConfirmBubbleModel* model);
43 42
44 protected: 43 protected:
45 virtual ~ConfirmBubbleView(); 44 virtual ~ConfirmBubbleView();
46 45
47 // BubbleDelegate implementation.
48 virtual void BubbleClosing(Bubble* bubble, bool closed_by_escape) OVERRIDE;
49 virtual bool CloseOnEscape() OVERRIDE;
50 virtual bool FadeInOnShow() OVERRIDE;
51
52 // views::ButtonListener implementation. 46 // views::ButtonListener implementation.
53 virtual void ButtonPressed(views::Button* sender, 47 virtual void ButtonPressed(views::Button* sender,
54 const views::Event& event) OVERRIDE; 48 const views::Event& event) OVERRIDE;
55 49
56 // views::LinkListener implementation. 50 // views::LinkListener implementation.
57 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; 51 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE;
58 52
59 // views::View implementation. 53 // views::BubbleDelegateView implementation.
60 virtual void ViewHierarchyChanged(bool is_add, 54 virtual gfx::Point GetAnchorPoint() OVERRIDE;
61 views::View* parent, 55 virtual void Init() OVERRIDE;
62 views::View* child) OVERRIDE;
63 56
64 private: 57 private:
58 // The screen point where this bubble is anchored.
59 gfx::Point anchor_point_;
60
65 // The model to customize this bubble view. 61 // The model to customize this bubble view.
66 scoped_ptr<ConfirmBubbleModel> model_; 62 scoped_ptr<ConfirmBubbleModel> model_;
67 63
68 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleView); 64 DISALLOW_COPY_AND_ASSIGN(ConfirmBubbleView);
69 }; 65 };
70 66
71 #endif // CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEW_H_ 67 #endif // CHROME_BROWSER_UI_VIEWS_CONFIRM_BUBBLE_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/confirm_bubble_model.cc ('k') | chrome/browser/ui/views/confirm_bubble_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698