| 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) { |
| 155 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); | 161 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); |
| 156 const SkColor color = widget->GetNativeTheme()->GetSystemColor( | 162 const SkColor color = widget->GetNativeTheme()->GetSystemColor( |
| 157 ui::NativeTheme::kColorId_DialogBackground); | 163 ui::NativeTheme::kColorId_DialogBackground); |
| 158 frame->SetBubbleBorder( | 164 if (force_opaque_border) { |
| 159 new BubbleBorder(BubbleBorder::FLOAT, BubbleBorder::SMALL_SHADOW, color)); | 165 frame->SetBubbleBorder(new BubbleBorder( |
| 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 } |
| 160 frame->SetTitle(widget->widget_delegate()->GetWindowTitle()); | 174 frame->SetTitle(widget->widget_delegate()->GetWindowTitle()); |
| 161 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 175 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 162 if (delegate) { | 176 if (delegate) { |
| 163 View* titlebar_view = delegate->CreateTitlebarExtraView(); | 177 View* titlebar_view = delegate->CreateTitlebarExtraView(); |
| 164 if (titlebar_view) | 178 if (titlebar_view) |
| 165 frame->SetTitlebarExtraView(titlebar_view); | 179 frame->SetTitlebarExtraView(titlebar_view); |
| 166 } | 180 } |
| 167 frame->SetShowCloseButton(true); | 181 frame->SetShowCloseButton(true); |
| 168 frame->set_can_drag(true); | 182 frame->set_can_drag(true); |
| 183 if (force_opaque_border) |
| 184 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); |
| 169 return frame; | 185 return frame; |
| 170 } | 186 } |
| 171 | 187 |
| 172 const DialogClientView* DialogDelegate::GetDialogClientView() const { | 188 const DialogClientView* DialogDelegate::GetDialogClientView() const { |
| 173 return GetWidget()->client_view()->AsDialogClientView(); | 189 return GetWidget()->client_view()->AsDialogClientView(); |
| 174 } | 190 } |
| 175 | 191 |
| 176 DialogClientView* DialogDelegate::GetDialogClientView() { | 192 DialogClientView* DialogDelegate::GetDialogClientView() { |
| 177 return GetWidget()->client_view()->AsDialogClientView(); | 193 return GetWidget()->client_view()->AsDialogClientView(); |
| 178 } | 194 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 208 | 224 |
| 209 const Widget* DialogDelegateView::GetWidget() const { | 225 const Widget* DialogDelegateView::GetWidget() const { |
| 210 return View::GetWidget(); | 226 return View::GetWidget(); |
| 211 } | 227 } |
| 212 | 228 |
| 213 View* DialogDelegateView::GetContentsView() { | 229 View* DialogDelegateView::GetContentsView() { |
| 214 return this; | 230 return this; |
| 215 } | 231 } |
| 216 | 232 |
| 217 } // namespace views | 233 } // namespace views |
| OLD | NEW |