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

Side by Side Diff: chrome/browser/views/options/content_page_view.cc

Issue 115825: Move text_field.cc and rename the class to Textfield in preparation for porti... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 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 | « chrome/browser/views/new_profile_dialog.cc ('k') | chrome/browser/views/options/cookies_view.h » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/options/content_page_view.h" 5 #include "chrome/browser/views/options/content_page_view.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 #include <vsstyle.h> 9 #include <vsstyle.h>
10 #include <vssym32.h> 10 #include <vssym32.h>
(...skipping 10 matching lines...) Expand all
21 #include "chrome/browser/views/options/options_group_view.h" 21 #include "chrome/browser/views/options/options_group_view.h"
22 #include "chrome/browser/views/options/passwords_exceptions_window_view.h" 22 #include "chrome/browser/views/options/passwords_exceptions_window_view.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
25 #include "chrome/common/pref_service.h" 25 #include "chrome/common/pref_service.h"
26 #include "grit/app_resources.h" 26 #include "grit/app_resources.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "skia/ext/skia_utils_win.h" 28 #include "skia/ext/skia_utils_win.h"
29 #include "third_party/skia/include/core/SkBitmap.h" 29 #include "third_party/skia/include/core/SkBitmap.h"
30 #include "views/controls/button/radio_button.h" 30 #include "views/controls/button/radio_button.h"
31 #include "views/controls/text_field.h" 31 #include "views/controls/textfield/textfield.h"
32 #include "views/grid_layout.h" 32 #include "views/grid_layout.h"
33 #include "views/standard_layout.h" 33 #include "views/standard_layout.h"
34 #include "views/widget/widget.h" 34 #include "views/widget/widget.h"
35 35
36 namespace { 36 namespace {
37 37
38 static const int kPopupBlockingRadioGroup = 1; 38 static const int kPopupBlockingRadioGroup = 1;
39 static const int kPasswordSavingRadioGroup = 2; 39 static const int kPasswordSavingRadioGroup = 2;
40 static const int kFileIconSize = 16; 40 static const int kFileIconSize = 16;
41 static const int kFileIconVerticalSpacing = 3; 41 static const int kFileIconVerticalSpacing = 3;
42 static const int kFileIconHorizontalSpacing = 3; 42 static const int kFileIconHorizontalSpacing = 3;
43 static const int kFileIconTextFieldSpacing = 3; 43 static const int kFileIconTextfieldSpacing = 3;
44 } // namespace 44 } // namespace
45 45
46 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
47 // FileDisplayArea 47 // FileDisplayArea
48 48
49 class FileDisplayArea : public views::View { 49 class FileDisplayArea : public views::View {
50 public: 50 public:
51 FileDisplayArea(); 51 FileDisplayArea();
52 virtual ~FileDisplayArea(); 52 virtual ~FileDisplayArea();
53 53
54 void SetFile(const FilePath& file_path); 54 void SetFile(const FilePath& file_path);
55 55
56 // views::View overrides: 56 // views::View overrides:
57 virtual void Paint(gfx::Canvas* canvas); 57 virtual void Paint(gfx::Canvas* canvas);
58 virtual void Layout(); 58 virtual void Layout();
59 virtual gfx::Size GetPreferredSize(); 59 virtual gfx::Size GetPreferredSize();
60 60
61 protected: 61 protected:
62 // views::View overrides: 62 // views::View overrides:
63 virtual void ViewHierarchyChanged(bool is_add, 63 virtual void ViewHierarchyChanged(bool is_add,
64 views::View* parent, 64 views::View* parent,
65 views::View* child); 65 views::View* child);
66 66
67 private: 67 private:
68 void Init(); 68 void Init();
69 69
70 views::TextField* text_field_; 70 views::Textfield* text_field_;
71 SkColor text_field_background_color_; 71 SkColor text_field_background_color_;
72 72
73 gfx::Rect icon_bounds_; 73 gfx::Rect icon_bounds_;
74 74
75 bool initialized_; 75 bool initialized_;
76 76
77 static void InitClass(); 77 static void InitClass();
78 static SkBitmap default_folder_icon_; 78 static SkBitmap default_folder_icon_;
79 79
80 DISALLOW_EVIL_CONSTRUCTORS(FileDisplayArea); 80 DISALLOW_EVIL_CONSTRUCTORS(FileDisplayArea);
81 }; 81 };
82 82
83 // static 83 // static
84 SkBitmap FileDisplayArea::default_folder_icon_; 84 SkBitmap FileDisplayArea::default_folder_icon_;
85 85
86 FileDisplayArea::FileDisplayArea() 86 FileDisplayArea::FileDisplayArea()
87 : text_field_(new views::TextField), 87 : text_field_(new views::Textfield),
88 text_field_background_color_(0), 88 text_field_background_color_(0),
89 initialized_(false) { 89 initialized_(false) {
90 InitClass(); 90 InitClass();
91 } 91 }
92 92
93 FileDisplayArea::~FileDisplayArea() { 93 FileDisplayArea::~FileDisplayArea() {
94 } 94 }
95 95
96 void FileDisplayArea::SetFile(const FilePath& file_path) { 96 void FileDisplayArea::SetFile(const FilePath& file_path) {
97 // Force file path to have LTR directionality. 97 // Force file path to have LTR directionality.
(...skipping 16 matching lines...) Expand all
114 // Mirror left point for icon_bounds_ to draw icon in RTL locales correctly. 114 // Mirror left point for icon_bounds_ to draw icon in RTL locales correctly.
115 canvas->DrawBitmapInt(default_folder_icon_, 115 canvas->DrawBitmapInt(default_folder_icon_,
116 MirroredLeftPointForRect(icon_bounds_), 116 MirroredLeftPointForRect(icon_bounds_),
117 icon_bounds_.y()); 117 icon_bounds_.y());
118 } 118 }
119 119
120 void FileDisplayArea::Layout() { 120 void FileDisplayArea::Layout() {
121 icon_bounds_.SetRect(kFileIconHorizontalSpacing, kFileIconVerticalSpacing, 121 icon_bounds_.SetRect(kFileIconHorizontalSpacing, kFileIconVerticalSpacing,
122 kFileIconSize, kFileIconSize); 122 kFileIconSize, kFileIconSize);
123 gfx::Size ps = text_field_->GetPreferredSize(); 123 gfx::Size ps = text_field_->GetPreferredSize();
124 text_field_->SetBounds(icon_bounds_.right() + kFileIconTextFieldSpacing, 124 text_field_->SetBounds(icon_bounds_.right() + kFileIconTextfieldSpacing,
125 (height() - ps.height()) / 2, 125 (height() - ps.height()) / 2,
126 width() - icon_bounds_.right() - 126 width() - icon_bounds_.right() -
127 kFileIconHorizontalSpacing - 127 kFileIconHorizontalSpacing -
128 kFileIconTextFieldSpacing, ps.height()); 128 kFileIconTextfieldSpacing, ps.height());
129 } 129 }
130 130
131 gfx::Size FileDisplayArea::GetPreferredSize() { 131 gfx::Size FileDisplayArea::GetPreferredSize() {
132 return gfx::Size(kFileIconSize + 2 * kFileIconVerticalSpacing, 132 return gfx::Size(kFileIconSize + 2 * kFileIconVerticalSpacing,
133 kFileIconSize + 2 * kFileIconHorizontalSpacing); 133 kFileIconSize + 2 * kFileIconHorizontalSpacing);
134 } 134 }
135 135
136 void FileDisplayArea::ViewHierarchyChanged(bool is_add, 136 void FileDisplayArea::ViewHierarchyChanged(bool is_add,
137 views::View* parent, 137 views::View* parent,
138 views::View* child) { 138 views::View* child) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 themes_group_ = new OptionsGroupView( 542 themes_group_ = new OptionsGroupView(
543 contents, l10n_util::GetString(IDS_THEMES_GROUP_NAME), 543 contents, l10n_util::GetString(IDS_THEMES_GROUP_NAME),
544 L"", false); 544 L"", false);
545 } 545 }
546 546
547 void ContentPageView::UpdateDownloadDirectoryDisplay() { 547 void ContentPageView::UpdateDownloadDirectoryDisplay() {
548 download_default_download_location_display_->SetFile( 548 download_default_download_location_display_->SetFile(
549 FilePath::FromWStringHack(default_download_location_.GetValue())); 549 FilePath::FromWStringHack(default_download_location_.GetValue()));
550 } 550 }
OLDNEW
« no previous file with comments | « chrome/browser/views/new_profile_dialog.cc ('k') | chrome/browser/views/options/cookies_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698