| 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 "ui/views/window/dialog_delegate.h" | 5 #include "ui/views/window/dialog_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 return new DialogClientView(widget, GetContentsView()); | 145 return new DialogClientView(widget, GetContentsView()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { | 148 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { |
| 149 return UseNewStyle() ? CreateNewStyleFrameView(widget) : | 149 return UseNewStyle() ? CreateNewStyleFrameView(widget) : |
| 150 WidgetDelegate::CreateNonClientFrameView(widget); | 150 WidgetDelegate::CreateNonClientFrameView(widget); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // static | 153 // static |
| 154 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) { | 154 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView(Widget* widget) { |
| 155 return CreateNewStyleFrameView(widget, false); | |
| 156 } | |
| 157 | |
| 158 NonClientFrameView* DialogDelegate::CreateNewStyleFrameView( | |
| 159 Widget* widget, | |
| 160 bool force_opaque_border) { | |
| 161 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); | 155 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); |
| 162 const SkColor color = widget->GetNativeTheme()->GetSystemColor( | 156 const SkColor color = widget->GetNativeTheme()->GetSystemColor( |
| 163 ui::NativeTheme::kColorId_DialogBackground); | 157 ui::NativeTheme::kColorId_DialogBackground); |
| 164 if (force_opaque_border) { | 158 frame->SetBubbleBorder( |
| 165 frame->SetBubbleBorder(new BubbleBorder( | 159 new BubbleBorder(BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color)); |
| 166 BubbleBorder::NONE, | |
| 167 BubbleBorder::NO_SHADOW_OPAQUE_BORDER, | |
| 168 color)); | |
| 169 } else { | |
| 170 frame->SetBubbleBorder(new BubbleBorder(BubbleBorder::FLOAT, | |
| 171 BubbleBorder::SMALL_SHADOW, | |
| 172 color)); | |
| 173 } | |
| 174 frame->SetTitle(widget->widget_delegate()->GetWindowTitle()); | 160 frame->SetTitle(widget->widget_delegate()->GetWindowTitle()); |
| 175 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 161 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 176 if (delegate) { | 162 if (delegate) { |
| 177 View* titlebar_view = delegate->CreateTitlebarExtraView(); | 163 View* titlebar_view = delegate->CreateTitlebarExtraView(); |
| 178 if (titlebar_view) | 164 if (titlebar_view) |
| 179 frame->SetTitlebarExtraView(titlebar_view); | 165 frame->SetTitlebarExtraView(titlebar_view); |
| 180 } | 166 } |
| 181 frame->SetShowCloseButton(true); | 167 frame->SetShowCloseButton(true); |
| 182 frame->set_can_drag(true); | 168 frame->set_can_drag(true); |
| 183 if (force_opaque_border) | |
| 184 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); | |
| 185 return frame; | 169 return frame; |
| 186 } | 170 } |
| 187 | 171 |
| 188 const DialogClientView* DialogDelegate::GetDialogClientView() const { | 172 const DialogClientView* DialogDelegate::GetDialogClientView() const { |
| 189 return GetWidget()->client_view()->AsDialogClientView(); | 173 return GetWidget()->client_view()->AsDialogClientView(); |
| 190 } | 174 } |
| 191 | 175 |
| 192 DialogClientView* DialogDelegate::GetDialogClientView() { | 176 DialogClientView* DialogDelegate::GetDialogClientView() { |
| 193 return GetWidget()->client_view()->AsDialogClientView(); | 177 return GetWidget()->client_view()->AsDialogClientView(); |
| 194 } | 178 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 224 | 208 |
| 225 const Widget* DialogDelegateView::GetWidget() const { | 209 const Widget* DialogDelegateView::GetWidget() const { |
| 226 return View::GetWidget(); | 210 return View::GetWidget(); |
| 227 } | 211 } |
| 228 | 212 |
| 229 View* DialogDelegateView::GetContentsView() { | 213 View* DialogDelegateView::GetContentsView() { |
| 230 return this; | 214 return this; |
| 231 } | 215 } |
| 232 | 216 |
| 233 } // namespace views | 217 } // namespace views |
| OLD | NEW |