Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 10387121: Revert 136996 - ui: Move NativeTheme files into ui/base/native_theme/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | webkit/glue/webthemeengine_impl_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #include <uxtheme.h> 11 #include <uxtheme.h>
12 #include <vsstyle.h> 12 #include <vsstyle.h>
13 #endif 13 #endif
14 14
15 #include <algorithm> 15 #include <algorithm>
16 16
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "grit/ui_strings.h" 18 #include "grit/ui_strings.h"
19 #include "ui/base/hit_test.h" 19 #include "ui/base/hit_test.h"
20 #include "ui/base/keycodes/keyboard_codes.h" 20 #include "ui/base/keycodes/keyboard_codes.h"
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/native_theme/native_theme.h"
23 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
24 #include "ui/gfx/canvas.h" 23 #include "ui/gfx/canvas.h"
25 #include "ui/gfx/font.h" 24 #include "ui/gfx/font.h"
25 #include "ui/gfx/native_theme.h"
26 #include "ui/views/controls/button/text_button.h" 26 #include "ui/views/controls/button/text_button.h"
27 #include "ui/views/layout/layout_constants.h" 27 #include "ui/views/layout/layout_constants.h"
28 #include "ui/views/widget/root_view.h" 28 #include "ui/views/widget/root_view.h"
29 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
30 #include "ui/views/window/dialog_delegate.h" 30 #include "ui/views/window/dialog_delegate.h"
31 31
32 namespace views { 32 namespace views {
33 namespace { 33 namespace {
34 34
35 const int kDialogMinButtonWidth = 75; 35 const int kDialogMinButtonWidth = 75;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 const DialogClientView* DialogClientView::AsDialogClientView() const { 300 const DialogClientView* DialogClientView::AsDialogClientView() const {
301 return this; 301 return this;
302 } 302 }
303 303
304 //////////////////////////////////////////////////////////////////////////////// 304 ////////////////////////////////////////////////////////////////////////////////
305 // DialogClientView, View overrides: 305 // DialogClientView, View overrides:
306 306
307 void DialogClientView::OnPaint(gfx::Canvas* canvas) { 307 void DialogClientView::OnPaint(gfx::Canvas* canvas) {
308 SkColor bg_color = ui::NativeTheme::instance()->GetSystemColor( 308 SkColor bg_color = gfx::NativeTheme::instance()->GetSystemColor(
309 ui::NativeTheme::kColorId_DialogBackground); 309 gfx::NativeTheme::kColorId_DialogBackground);
310 canvas->FillRect(GetLocalBounds(), bg_color); 310 canvas->FillRect(GetLocalBounds(), bg_color);
311 } 311 }
312 312
313 void DialogClientView::PaintChildren(gfx::Canvas* canvas) { 313 void DialogClientView::PaintChildren(gfx::Canvas* canvas) {
314 View::PaintChildren(canvas); 314 View::PaintChildren(canvas);
315 if (!GetWidget()->IsMaximized() && !GetWidget()->IsMinimized()) 315 if (!GetWidget()->IsMaximized() && !GetWidget()->IsMinimized())
316 PaintSizeBox(canvas); 316 PaintSizeBox(canvas);
317 } 317 }
318 318
319 void DialogClientView::Layout() { 319 void DialogClientView::Layout() {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 413 }
414 } 414 }
415 415
416 //////////////////////////////////////////////////////////////////////////////// 416 ////////////////////////////////////////////////////////////////////////////////
417 // DialogClientView, private: 417 // DialogClientView, private:
418 418
419 void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { 419 void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) {
420 if (GetWidget()->widget_delegate()->CanResize() || 420 if (GetWidget()->widget_delegate()->CanResize() ||
421 GetWidget()->widget_delegate()->CanMaximize()) { 421 GetWidget()->widget_delegate()->CanMaximize()) {
422 #if defined(OS_WIN) 422 #if defined(OS_WIN)
423 ui::NativeTheme::ExtraParams extra; 423 gfx::NativeTheme::ExtraParams extra;
424 gfx::Size gripper_size = ui::NativeTheme::instance()->GetPartSize( 424 gfx::Size gripper_size = gfx::NativeTheme::instance()->GetPartSize(
425 ui::NativeTheme::kWindowResizeGripper, ui::NativeTheme::kNormal, 425 gfx::NativeTheme::kWindowResizeGripper, gfx::NativeTheme::kNormal,
426 extra); 426 extra);
427 427
428 // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't 428 // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't
429 // a theme-supplied gripper. We should probably improvise 429 // a theme-supplied gripper. We should probably improvise
430 // something, which would also require changing |gripper_size| 430 // something, which would also require changing |gripper_size|
431 // to have different default values, too... 431 // to have different default values, too...
432 size_box_bounds_ = GetContentsBounds(); 432 size_box_bounds_ = GetContentsBounds();
433 size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.width()); 433 size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.width());
434 size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.height()); 434 size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.height());
435 435
436 ui::NativeTheme::instance()->Paint(canvas->sk_canvas(), 436 gfx::NativeTheme::instance()->Paint(canvas->sk_canvas(),
437 ui::NativeTheme::kWindowResizeGripper, 437 gfx::NativeTheme::kWindowResizeGripper,
438 ui::NativeTheme::kNormal, 438 gfx::NativeTheme::kNormal,
439 size_box_bounds_, 439 size_box_bounds_,
440 extra); 440 extra);
441 #else 441 #else
442 NOTIMPLEMENTED(); 442 NOTIMPLEMENTED();
443 // TODO(port): paint size box 443 // TODO(port): paint size box
444 #endif 444 #endif
445 } 445 }
446 } 446 }
447 447
448 int DialogClientView::GetButtonWidth(int button) const { 448 int DialogClientView::GetButtonWidth(int button) const {
449 DialogDelegate* dd = GetDialogDelegate(); 449 DialogDelegate* dd = GetDialogDelegate();
450 string16 button_label = dd->GetDialogButtonLabel( 450 string16 button_label = dd->GetDialogButtonLabel(
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 553 }
554 saved_focus_manager_ = focus_manager; 554 saved_focus_manager_ = focus_manager;
555 // Listen for focus change events so we can update the default button. 555 // Listen for focus change events so we can update the default button.
556 if (focus_manager) { 556 if (focus_manager) {
557 focus_manager->AddFocusChangeListener(this); 557 focus_manager->AddFocusChangeListener(this);
558 listening_to_focus_ = true; 558 listening_to_focus_ = true;
559 } 559 }
560 } 560 }
561 561
562 } // namespace views 562 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/native_widget_win.cc ('k') | webkit/glue/webthemeengine_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698