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

Side by Side Diff: chrome/browser/ui/confirm_bubble_model.cc

Issue 8746001: Rebase ConfirmBubble on the new views bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 #include "chrome/browser/ui/confirm_bubble_model.h" 5 #include "chrome/browser/ui/confirm_bubble_model.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/generated_resources.h" 8 #include "grit/generated_resources.h"
9 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
10 10
11 #if defined(TOOLKIT_VIEWS) 11 #if defined(TOOLKIT_VIEWS)
12 #include "chrome/browser/ui/views/confirm_bubble_view.h" 12 #include "chrome/browser/ui/views/confirm_bubble_view.h"
13 #include "ui/gfx/rect.h" 13 #include "chrome/browser/ui/views/window.h"
14 #include "ui/views/widget/widget.h"
15 #endif 14 #endif
16 15
17 ConfirmBubbleModel::ConfirmBubbleModel() { 16 ConfirmBubbleModel::ConfirmBubbleModel() {
18 } 17 }
19 18
20 ConfirmBubbleModel::~ConfirmBubbleModel() { 19 ConfirmBubbleModel::~ConfirmBubbleModel() {
21 } 20 }
22 21
23 int ConfirmBubbleModel::GetButtons() const { 22 int ConfirmBubbleModel::GetButtons() const {
24 return BUTTON_OK | BUTTON_CANCEL; 23 return BUTTON_OK | BUTTON_CANCEL;
25 } 24 }
26 25
27 string16 ConfirmBubbleModel::GetButtonLabel(BubbleButton button) const { 26 string16 ConfirmBubbleModel::GetButtonLabel(BubbleButton button) const {
28 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL); 27 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_OK : IDS_CANCEL);
29 } 28 }
30 29
31 void ConfirmBubbleModel::Accept() { 30 void ConfirmBubbleModel::Accept() {
32 } 31 }
33 32
34 void ConfirmBubbleModel::Cancel() { 33 void ConfirmBubbleModel::Cancel() {
35 } 34 }
36 35
37 string16 ConfirmBubbleModel::GetLinkText() const { 36 string16 ConfirmBubbleModel::GetLinkText() const {
38 return string16(); 37 return string16();
39 } 38 }
40 39
41 void ConfirmBubbleModel::LinkClicked() { 40 void ConfirmBubbleModel::LinkClicked() {
42 } 41 }
43 42
44 void ConfirmBubbleModel::Show(gfx::NativeView view, 43 void ConfirmBubbleModel::Show(const gfx::Point& origin,
45 const gfx::Point& origin,
46 ConfirmBubbleModel* model) { 44 ConfirmBubbleModel* model) {
47 #if defined(TOOLKIT_VIEWS) 45 #if defined(TOOLKIT_VIEWS)
48 views::Widget* parent = views::Widget::GetTopLevelWidgetForNativeView(view); 46 ConfirmBubbleView* bubble_view = new ConfirmBubbleView(origin, model);
49 if (!parent) 47 browser::CreateViewsBubble(bubble_view);
50 return; 48 bubble_view->Show();
51
52 ConfirmBubbleView* bubble_view = new ConfirmBubbleView(model);
53 Bubble* bubble = Bubble::Show(parent, gfx::Rect(origin, gfx::Size()),
54 views::BubbleBorder::NONE,
55 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR,
56 bubble_view, bubble_view);
57 bubble->SizeToContents();
58 #else 49 #else
59 NOTIMPLEMENTED(); // Bug 99130: Implement it. 50 NOTIMPLEMENTED(); // Bug 99130: Implement it.
60 #endif 51 #endif
61 } 52 }
62 53
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698