| OLD | NEW |
| 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/tab_modal_confirm_dialog_views.h" | 5 #include "chrome/browser/ui/views/tab_modal_confirm_dialog_views.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/browser_dialogs.h" | 9 #include "chrome/browser/ui/browser_dialogs.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 return new TabModalConfirmDialogViews(delegate, tab_contents); | 25 return new TabModalConfirmDialogViews(delegate, tab_contents); |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 const int kChromeStyleUniformInset = 0; | 29 const int kChromeStyleUniformInset = 0; |
| 30 const int kChromeStyleInterRowVerticalSpacing = 20; | 30 const int kChromeStyleInterRowVerticalSpacing = 20; |
| 31 | 31 |
| 32 const int kChromeStyleButtonVEdgeMargin = 0; | 32 const int kChromeStyleButtonVEdgeMargin = 0; |
| 33 const int kChromeStyleButtonHEdgeMargin = 0; | 33 const int kChromeStyleButtonHEdgeMargin = 0; |
| 34 const int kChromeStyleDialogButtonLabelSpacing = 24; | 34 const int kChromeStyleDialogButtonLabelSpacing = 24; |
| 35 const int kChromeStyleButtonContentSpacing = 0; |
| 35 | 36 |
| 36 views::MessageBoxView::InitParams CreateMessageBoxViewInitParams( | 37 views::MessageBoxView::InitParams CreateMessageBoxViewInitParams( |
| 37 const string16& message) | 38 const string16& message) |
| 38 { | 39 { |
| 39 views::MessageBoxView::InitParams params(message); | 40 views::MessageBoxView::InitParams params(message); |
| 40 | 41 |
| 41 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 42 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 42 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { | 43 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { |
| 43 params.top_inset = kChromeStyleUniformInset; | 44 params.top_inset = kChromeStyleUniformInset; |
| 44 params.bottom_inset = kChromeStyleUniformInset; | 45 params.bottom_inset = kChromeStyleUniformInset; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 views::ClientView* TabModalConfirmDialogViews::CreateClientView( | 106 views::ClientView* TabModalConfirmDialogViews::CreateClientView( |
| 106 views::Widget* widget) { | 107 views::Widget* widget) { |
| 107 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 108 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 108 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { | 109 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { |
| 109 views::DialogClientView::StyleParams params; | 110 views::DialogClientView::StyleParams params; |
| 110 params.button_vedge_margin = kChromeStyleButtonVEdgeMargin; | 111 params.button_vedge_margin = kChromeStyleButtonVEdgeMargin; |
| 111 params.button_hedge_margin = kChromeStyleButtonHEdgeMargin; | 112 params.button_hedge_margin = kChromeStyleButtonHEdgeMargin; |
| 112 params.button_label_spacing = kChromeStyleDialogButtonLabelSpacing; | 113 params.button_label_spacing = kChromeStyleDialogButtonLabelSpacing; |
| 113 params.text_button_factory = | 114 params.text_button_factory = |
| 114 &views::DialogClientView::CreateChromeStyleDialogButton; | 115 &views::DialogClientView::CreateChromeStyleDialogButton; |
| 116 params.button_content_spacing = kChromeStyleButtonContentSpacing; |
| 115 | 117 |
| 116 return new views::DialogClientView(widget, GetContentsView(), params); | 118 return new views::DialogClientView(widget, GetContentsView(), params); |
| 117 } | 119 } |
| 118 | 120 |
| 119 return DialogDelegate::CreateClientView(widget); | 121 return DialogDelegate::CreateClientView(widget); |
| 120 } | 122 } |
| 121 | 123 |
| 122 /////////////////////////////////////////////////////////////////////////////// | 124 /////////////////////////////////////////////////////////////////////////////// |
| 123 // TabModalConfirmDialogViews, views::WidgetDelegate implementation: | 125 // TabModalConfirmDialogViews, views::WidgetDelegate implementation: |
| 124 | 126 |
| 125 views::View* TabModalConfirmDialogViews::GetContentsView() { | 127 views::View* TabModalConfirmDialogViews::GetContentsView() { |
| 126 return message_box_view_; | 128 return message_box_view_; |
| 127 } | 129 } |
| 128 | 130 |
| 129 views::Widget* TabModalConfirmDialogViews::GetWidget() { | 131 views::Widget* TabModalConfirmDialogViews::GetWidget() { |
| 130 return message_box_view_->GetWidget(); | 132 return message_box_view_->GetWidget(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { | 135 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { |
| 134 return message_box_view_->GetWidget(); | 136 return message_box_view_->GetWidget(); |
| 135 } | 137 } |
| 136 | 138 |
| 137 void TabModalConfirmDialogViews::DeleteDelegate() { | 139 void TabModalConfirmDialogViews::DeleteDelegate() { |
| 138 delete this; | 140 delete this; |
| 139 } | 141 } |
| OLD | NEW |