| OLD | NEW |
| 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; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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(gfx::NativeView view, |
| 45 const gfx::Point& origin, | 44 const gfx::Point& origin, |
| 46 ConfirmBubbleModel* model) { | 45 ConfirmBubbleModel* model) { |
| 47 #if defined(TOOLKIT_VIEWS) | 46 #if defined(TOOLKIT_VIEWS) |
| 48 views::Widget* parent = views::Widget::GetTopLevelWidgetForNativeView(view); | 47 ConfirmBubbleView* bubble_view = new ConfirmBubbleView(origin, model); |
| 49 if (!parent) | 48 browser::CreateViewsBubble(bubble_view); |
| 50 return; | 49 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 | 50 #else |
| 59 NOTIMPLEMENTED(); // Bug 99130: Implement it. | 51 NOTIMPLEMENTED(); // Bug 99130: Implement it. |
| 60 #endif | 52 #endif |
| 61 } | 53 } |
| 62 | 54 |
| OLD | NEW |