| 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 16 matching lines...) Expand all Loading... |
| 27 bool enable_chrome_style = | 27 bool enable_chrome_style = |
| 28 CommandLine::ForCurrentProcess()->HasSwitch( | 28 CommandLine::ForCurrentProcess()->HasSwitch( |
| 29 switches::kEnableFramelessConstrainedDialogs); | 29 switches::kEnableFramelessConstrainedDialogs); |
| 30 return new TabModalConfirmDialogViews(delegate, | 30 return new TabModalConfirmDialogViews(delegate, |
| 31 tab_contents, | 31 tab_contents, |
| 32 enable_chrome_style); | 32 enable_chrome_style); |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 const int kChromeStyleUniformInset = 0; | 36 const int kChromeStyleUniformInset = 0; |
| 37 const int kChromeStyleInterRowVerticalSpacing = 20; | 37 const int kChromeStyleInterRowVerticalSpacing = 17; |
| 38 | 38 |
| 39 const int kChromeStyleButtonVEdgeMargin = 0; | 39 const int kChromeStyleButtonVEdgeMargin = 0; |
| 40 const int kChromeStyleButtonHEdgeMargin = 0; | 40 const int kChromeStyleButtonHEdgeMargin = 0; |
| 41 const int kChromeStyleDialogButtonLabelSpacing = 24; | 41 const int kChromeStyleDialogButtonLabelSpacing = 24; |
| 42 const int kChromeStyleButtonContentSpacing = 0; |
| 42 | 43 |
| 43 views::MessageBoxView::InitParams CreateMessageBoxViewInitParams( | 44 views::MessageBoxView::InitParams CreateMessageBoxViewInitParams( |
| 44 const string16& message, | 45 const string16& message, |
| 45 bool enable_chrome_style) | 46 bool enable_chrome_style) |
| 46 { | 47 { |
| 47 views::MessageBoxView::InitParams params(message); | 48 views::MessageBoxView::InitParams params(message); |
| 48 | 49 |
| 49 if (enable_chrome_style) { | 50 if (enable_chrome_style) { |
| 50 params.top_inset = kChromeStyleUniformInset; | 51 params.top_inset = kChromeStyleUniformInset; |
| 51 params.bottom_inset = kChromeStyleUniformInset; | 52 params.bottom_inset = kChromeStyleUniformInset; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 views::ClientView* TabModalConfirmDialogViews::CreateClientView( | 116 views::ClientView* TabModalConfirmDialogViews::CreateClientView( |
| 116 views::Widget* widget) { | 117 views::Widget* widget) { |
| 117 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 118 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 118 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { | 119 if (command_line->HasSwitch(switches::kEnableFramelessConstrainedDialogs)) { |
| 119 views::DialogClientView::StyleParams params; | 120 views::DialogClientView::StyleParams params; |
| 120 params.button_vedge_margin = kChromeStyleButtonVEdgeMargin; | 121 params.button_vedge_margin = kChromeStyleButtonVEdgeMargin; |
| 121 params.button_hedge_margin = kChromeStyleButtonHEdgeMargin; | 122 params.button_hedge_margin = kChromeStyleButtonHEdgeMargin; |
| 122 params.button_label_spacing = kChromeStyleDialogButtonLabelSpacing; | 123 params.button_label_spacing = kChromeStyleDialogButtonLabelSpacing; |
| 123 params.text_button_factory = | 124 params.text_button_factory = |
| 124 &views::DialogClientView::CreateChromeStyleDialogButton; | 125 &views::DialogClientView::CreateChromeStyleDialogButton; |
| 126 params.button_content_spacing = kChromeStyleButtonContentSpacing; |
| 125 | 127 |
| 126 return new views::DialogClientView(widget, GetContentsView(), params); | 128 return new views::DialogClientView(widget, GetContentsView(), params); |
| 127 } | 129 } |
| 128 | 130 |
| 129 return DialogDelegate::CreateClientView(widget); | 131 return DialogDelegate::CreateClientView(widget); |
| 130 } | 132 } |
| 131 | 133 |
| 132 /////////////////////////////////////////////////////////////////////////////// | 134 /////////////////////////////////////////////////////////////////////////////// |
| 133 // TabModalConfirmDialogViews, views::WidgetDelegate implementation: | 135 // TabModalConfirmDialogViews, views::WidgetDelegate implementation: |
| 134 | 136 |
| 135 views::View* TabModalConfirmDialogViews::GetContentsView() { | 137 views::View* TabModalConfirmDialogViews::GetContentsView() { |
| 136 return message_box_view_; | 138 return message_box_view_; |
| 137 } | 139 } |
| 138 | 140 |
| 139 views::Widget* TabModalConfirmDialogViews::GetWidget() { | 141 views::Widget* TabModalConfirmDialogViews::GetWidget() { |
| 140 return message_box_view_->GetWidget(); | 142 return message_box_view_->GetWidget(); |
| 141 } | 143 } |
| 142 | 144 |
| 143 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { | 145 const views::Widget* TabModalConfirmDialogViews::GetWidget() const { |
| 144 return message_box_view_->GetWidget(); | 146 return message_box_view_->GetWidget(); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void TabModalConfirmDialogViews::DeleteDelegate() { | 149 void TabModalConfirmDialogViews::DeleteDelegate() { |
| 148 delete this; | 150 delete this; |
| 149 } | 151 } |
| OLD | NEW |