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

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

Issue 801043003: Change ShowConfirmBubble() to take model by scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
OLDNEW
1 // Copyright (c) 2012 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_views.h" 5 #include "chrome/browser/ui/views/confirm_bubble_views.h"
6 6
7 #include "chrome/browser/ui/confirm_bubble.h" 7 #include "chrome/browser/ui/confirm_bubble.h"
8 #include "chrome/browser/ui/confirm_bubble_model.h" 8 #include "chrome/browser/ui/confirm_bubble_model.h"
9 #include "components/constrained_window/constrained_window_views.h" 9 #include "components/constrained_window/constrained_window_views.h"
10 #include "ui/views/controls/label.h" 10 #include "ui/views/controls/label.h"
11 #include "ui/views/controls/link.h" 11 #include "ui/views/controls/link.h"
12 #include "ui/views/layout/grid_layout.h" 12 #include "ui/views/layout/grid_layout.h"
13 #include "ui/views/layout/layout_constants.h" 13 #include "ui/views/layout/layout_constants.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 15
16 ConfirmBubbleViews::ConfirmBubbleViews(ConfirmBubbleModel* model) 16 ConfirmBubbleViews::ConfirmBubbleViews(scoped_ptr<ConfirmBubbleModel> model)
17 : model_(model), 17 : model_(model.Pass()),
18 link_(NULL) { 18 link_(NULL) {
19 views::GridLayout* layout = views::GridLayout::CreatePanel(this); 19 views::GridLayout* layout = views::GridLayout::CreatePanel(this);
20 SetLayoutManager(layout); 20 SetLayoutManager(layout);
21 21
22 // Use a fixed maximum message width, so longer messages will wrap. 22 // Use a fixed maximum message width, so longer messages will wrap.
23 const int kMaxMessageWidth = 400; 23 const int kMaxMessageWidth = 400;
24 views::ColumnSet* cs = layout->AddColumnSet(0); 24 views::ColumnSet* cs = layout->AddColumnSet(0);
25 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0, 25 cs->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER, 0,
26 views::GridLayout::FIXED, kMaxMessageWidth, false); 26 views::GridLayout::FIXED, kMaxMessageWidth, false);
27 27
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 model_->LinkClicked(); 95 model_->LinkClicked();
96 GetWidget()->Close(); 96 GetWidget()->Close();
97 } 97 }
98 } 98 }
99 99
100 namespace chrome { 100 namespace chrome {
101 101
102 void ShowConfirmBubble(gfx::NativeWindow window, 102 void ShowConfirmBubble(gfx::NativeWindow window,
103 gfx::NativeView anchor_view, 103 gfx::NativeView anchor_view,
104 const gfx::Point& origin, 104 const gfx::Point& origin,
105 ConfirmBubbleModel* model) { 105 scoped_ptr<ConfirmBubbleModel> model) {
106 constrained_window::CreateBrowserModalDialogViews( 106 constrained_window::CreateBrowserModalDialogViews(
107 new ConfirmBubbleViews(model), window)->Show(); 107 new ConfirmBubbleViews(model.Pass()), window)->Show();
108 } 108 }
109 109
110 } // namespace chrome 110 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/confirm_bubble_views.h ('k') | chrome/browser/ui/views/confirm_bubble_views_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698