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

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

Issue 8697001: Implement confirm bubble for Mac. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months 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
« no previous file with comments | « chrome/browser/ui/confirm_bubble_model.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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/views/confirm_bubble_view.h" 5 #include "chrome/browser/ui/views/confirm_bubble_view.h"
6 6
7 #include "chrome/browser/ui/confirm_bubble_model.h" 7 #include "chrome/browser/ui/confirm_bubble_model.h"
8 #include "chrome/browser/ui/views/window.h"
8 #include "grit/theme_resources.h" 9 #include "grit/theme_resources.h"
9 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/image/image.h" 11 #include "ui/gfx/image/image.h"
11 #include "ui/views/controls/button/image_button.h" 12 #include "ui/views/controls/button/image_button.h"
12 #include "ui/views/controls/button/text_button.h" 13 #include "ui/views/controls/button/text_button.h"
13 #include "ui/views/controls/image_view.h" 14 #include "ui/views/controls/image_view.h"
14 #include "ui/views/controls/label.h" 15 #include "ui/views/controls/label.h"
15 #include "ui/views/controls/link.h" 16 #include "ui/views/controls/link.h"
16 #include "ui/views/layout/grid_layout.h" 17 #include "ui/views/layout/grid_layout.h"
17 #include "ui/views/layout/layout_constants.h" 18 #include "ui/views/layout/layout_constants.h"
18 19
19 namespace { 20 namespace {
20 21
21 // Maximum width for the message field. We will wrap the message text when its 22 // Maximum width for the message field. We will wrap the message text when its
22 // width is wider than this. 23 // width is wider than this.
23 const int kMaxMessageWidth = 400; 24 const int kMaxMessageWidth = 400;
24 25
25 } // namespace 26 } // namespace
26 27
28 void ConfirmBubbleModel::Show(gfx::NativeView view,
29 const gfx::Point& origin,
30 ConfirmBubbleModel* model) {
31 ConfirmBubbleView* bubble_view = new ConfirmBubbleView(origin, model);
32 browser::CreateViewsBubble(bubble_view);
33 bubble_view->Show();
34 }
35
27 ConfirmBubbleView::ConfirmBubbleView(const gfx::Point& anchor_point, 36 ConfirmBubbleView::ConfirmBubbleView(const gfx::Point& anchor_point,
28 ConfirmBubbleModel* model) 37 ConfirmBubbleModel* model)
29 : BubbleDelegateView(NULL, views::BubbleBorder::NONE), 38 : BubbleDelegateView(NULL, views::BubbleBorder::NONE),
30 anchor_point_(anchor_point), 39 anchor_point_(anchor_point),
31 model_(model) { 40 model_(model) {
32 DCHECK(model); 41 DCHECK(model);
33 } 42 }
34 43
35 ConfirmBubbleView::~ConfirmBubbleView() { 44 ConfirmBubbleView::~ConfirmBubbleView() {
36 } 45 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 layout->AddView(ok_button); 150 layout->AddView(ok_button);
142 } 151 }
143 if (has_cancel_button) { 152 if (has_cancel_button) {
144 views::TextButton* cancel_button = new views::NativeTextButton( 153 views::TextButton* cancel_button = new views::NativeTextButton(
145 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); 154 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL));
146 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); 155 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL);
147 layout->AddView(cancel_button); 156 layout->AddView(cancel_button);
148 } 157 }
149 } 158 }
150 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/confirm_bubble_model.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698