Chromium Code Reviews| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
| 9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
| 10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 } | 147 } |
| 148 | 148 |
| 149 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { | 149 NonClientFrameView* DialogDelegate::CreateNonClientFrameView(Widget* widget) { |
| 150 if (UseNewStyleForThisDialog()) | 150 if (UseNewStyleForThisDialog()) |
| 151 return CreateDialogFrameView(widget); | 151 return CreateDialogFrameView(widget); |
| 152 return WidgetDelegate::CreateNonClientFrameView(widget); | 152 return WidgetDelegate::CreateNonClientFrameView(widget); |
| 153 } | 153 } |
| 154 | 154 |
| 155 // static | 155 // static |
| 156 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { | 156 NonClientFrameView* DialogDelegate::CreateDialogFrameView(Widget* widget) { |
| 157 return CreateDialogFrameView(widget, false); | |
| 158 } | |
| 159 | |
| 160 // static | |
| 161 NonClientFrameView* DialogDelegate::CreateDialogFrameView( | |
| 162 Widget* widget, | |
| 163 bool force_opaque_border) { | |
| 164 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); | 157 BubbleFrameView* frame = new BubbleFrameView(gfx::Insets()); |
| 165 const SkColor color = widget->GetNativeTheme()->GetSystemColor( | 158 const SkColor color = widget->GetNativeTheme()->GetSystemColor( |
| 166 ui::NativeTheme::kColorId_DialogBackground); | 159 ui::NativeTheme::kColorId_DialogBackground); |
| 167 if (force_opaque_border) { | 160 frame->SetBubbleBorder(new BubbleBorder(BubbleBorder::FLOAT, |
| 168 frame->SetBubbleBorder(new BubbleBorder( | 161 BubbleBorder::SMALL_SHADOW, |
| 169 BubbleBorder::NONE, | 162 color)); |
| 170 BubbleBorder::NO_SHADOW_OPAQUE_BORDER, | |
| 171 color)); | |
| 172 } else { | |
| 173 frame->SetBubbleBorder(new BubbleBorder(BubbleBorder::FLOAT, | |
| 174 BubbleBorder::SMALL_SHADOW, | |
| 175 color)); | |
| 176 } | |
| 177 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); | 163 DialogDelegate* delegate = widget->widget_delegate()->AsDialogDelegate(); |
| 178 if (delegate) { | 164 if (delegate) { |
| 179 View* titlebar_view = delegate->CreateTitlebarExtraView(); | 165 View* titlebar_view = delegate->CreateTitlebarExtraView(); |
| 180 if (titlebar_view) | 166 if (titlebar_view) |
| 181 frame->SetTitlebarExtraView(titlebar_view); | 167 frame->SetTitlebarExtraView(titlebar_view); |
| 182 } | 168 } |
| 183 if (force_opaque_border) | |
| 184 widget->set_frame_type(views::Widget::FRAME_TYPE_FORCE_CUSTOM); | |
| 185 #if defined(USE_AURA) | 169 #if defined(USE_AURA) |
|
Mike Wittman
2013/12/11 15:09:18
Remove this also.
msw
2013/12/11 17:47:13
We are trying to avoid breaking non-Aura Win until
| |
| 186 // TODO(msw): Add a matching shadow type and remove the bubble frame border? | 170 // TODO(msw): Add a matching shadow type and remove the bubble frame border? |
| 187 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE); | 171 corewm::SetShadowType(widget->GetNativeWindow(), corewm::SHADOW_TYPE_NONE); |
| 188 #endif | 172 #endif |
| 189 return frame; | 173 return frame; |
| 190 } | 174 } |
| 191 | 175 |
| 192 bool DialogDelegate::UseNewStyleForThisDialog() const { | 176 bool DialogDelegate::UseNewStyleForThisDialog() const { |
| 193 return true; | 177 return true; |
| 194 } | 178 } |
| 195 | 179 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 225 | 209 |
| 226 const Widget* DialogDelegateView::GetWidget() const { | 210 const Widget* DialogDelegateView::GetWidget() const { |
| 227 return View::GetWidget(); | 211 return View::GetWidget(); |
| 228 } | 212 } |
| 229 | 213 |
| 230 View* DialogDelegateView::GetContentsView() { | 214 View* DialogDelegateView::GetContentsView() { |
| 231 return this; | 215 return this; |
| 232 } | 216 } |
| 233 | 217 |
| 234 } // namespace views | 218 } // namespace views |
| OLD | NEW |