| 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/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 "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 model_->Accept(); | 41 model_->Accept(); |
| 42 else if (sender->tag() == ConfirmBubbleModel::BUTTON_CANCEL) | 42 else if (sender->tag() == ConfirmBubbleModel::BUTTON_CANCEL) |
| 43 model_->Cancel(); | 43 model_->Cancel(); |
| 44 GetWidget()->Close(); | 44 GetWidget()->Close(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void ConfirmBubbleView::LinkClicked(views::Link* source, int event_flags) { | 47 void ConfirmBubbleView::LinkClicked(views::Link* source, int event_flags) { |
| 48 model_->LinkClicked(); | 48 model_->LinkClicked(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 gfx::Point ConfirmBubbleView::GetAnchorPoint() { | 51 gfx::Rect ConfirmBubbleView::GetAnchorRect() { |
| 52 return anchor_point_; | 52 return gfx::Rect(anchor_point_, gfx::Size()); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void ConfirmBubbleView::Init() { | 55 void ConfirmBubbleView::Init() { |
| 56 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 56 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 57 views::GridLayout* layout = new views::GridLayout(this); | 57 views::GridLayout* layout = new views::GridLayout(this); |
| 58 SetLayoutManager(layout); | 58 SetLayoutManager(layout); |
| 59 | 59 |
| 60 // Add the icon, the title label and the close button to the first row. | 60 // Add the icon, the title label and the close button to the first row. |
| 61 views::ColumnSet* cs = layout->AddColumnSet(0); | 61 views::ColumnSet* cs = layout->AddColumnSet(0); |
| 62 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, | 62 cs->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 layout->AddView(ok_button); | 141 layout->AddView(ok_button); |
| 142 } | 142 } |
| 143 if (has_cancel_button) { | 143 if (has_cancel_button) { |
| 144 views::TextButton* cancel_button = new views::NativeTextButton( | 144 views::TextButton* cancel_button = new views::NativeTextButton( |
| 145 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); | 145 this, model_->GetButtonLabel(ConfirmBubbleModel::BUTTON_CANCEL)); |
| 146 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); | 146 cancel_button->set_tag(ConfirmBubbleModel::BUTTON_CANCEL); |
| 147 layout->AddView(cancel_button); | 147 layout->AddView(cancel_button); |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 } | 150 } |
| OLD | NEW |