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

Side by Side Diff: chrome/browser/ui/views/options/advanced_page_view.cc

Issue 6257006: Move a bunch of random other files to src/ui/base... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/views/options/advanced_page_view.h" 5 #include "chrome/browser/ui/views/options/advanced_page_view.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h"
9 #include "base/string_util.h" 8 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/options/options_util.h" 11 #include "chrome/browser/ui/options/options_util.h"
13 #include "chrome/browser/ui/views/options/advanced_contents_view.h" 12 #include "chrome/browser/ui/views/options/advanced_contents_view.h"
14 #include "chrome/browser/ui/views/options/managed_prefs_banner_view.h" 13 #include "chrome/browser/ui/views/options/managed_prefs_banner_view.h"
15 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
16 #include "grit/chromium_strings.h" 15 #include "grit/chromium_strings.h"
17 #include "grit/generated_resources.h" 16 #include "grit/generated_resources.h"
18 #include "grit/locale_settings.h" 17 #include "grit/locale_settings.h"
18 #include "ui/base/message_box_flags.h"
19 #include "views/controls/message_box_view.h" 19 #include "views/controls/message_box_view.h"
20 #include "views/controls/button/native_button.h" 20 #include "views/controls/button/native_button.h"
21 #include "views/controls/scroll_view.h" 21 #include "views/controls/scroll_view.h"
22 #include "views/grid_layout.h" 22 #include "views/grid_layout.h"
23 #include "views/standard_layout.h" 23 #include "views/standard_layout.h"
24 #include "views/window/dialog_delegate.h" 24 #include "views/window/dialog_delegate.h"
25 #include "views/window/window.h" 25 #include "views/window/window.h"
26 26
27 namespace { 27 namespace {
28 28
29 // A dialog box that asks the user to confirm resetting settings. 29 // A dialog box that asks the user to confirm resetting settings.
30 class ResetDefaultsConfirmBox : public views::DialogDelegate { 30 class ResetDefaultsConfirmBox : public views::DialogDelegate {
31 public: 31 public:
32 // This box is modal to |parent_hwnd|. 32 // This box is modal to |parent_hwnd|.
33 static void ShowConfirmBox(HWND parent_hwnd, AdvancedPageView* page_view) { 33 static void ShowConfirmBox(HWND parent_hwnd, AdvancedPageView* page_view) {
34 // When the window closes, it will delete itself. 34 // When the window closes, it will delete itself.
35 new ResetDefaultsConfirmBox(parent_hwnd, page_view); 35 new ResetDefaultsConfirmBox(parent_hwnd, page_view);
36 } 36 }
37 37
38 protected: 38 protected:
39 // views::DialogDelegate 39 // views::DialogDelegate
40 virtual std::wstring GetDialogButtonLabel( 40 virtual std::wstring GetDialogButtonLabel(
41 MessageBoxFlags::DialogButton button) const { 41 ui::MessageBoxFlags::DialogButton button) const {
42 switch (button) { 42 switch (button) {
43 case MessageBoxFlags::DIALOGBUTTON_OK: 43 case ui::MessageBoxFlags::DIALOGBUTTON_OK:
44 return UTF16ToWide( 44 return UTF16ToWide(
45 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_OKLABEL)); 45 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_OKLABEL));
46 case MessageBoxFlags::DIALOGBUTTON_CANCEL: 46 case ui::MessageBoxFlags::DIALOGBUTTON_CANCEL:
47 return UTF16ToWide( 47 return UTF16ToWide(
48 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_CANCELLABEL)); 48 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_CANCELLABEL));
49 default: 49 default:
50 break; 50 break;
51 } 51 }
52 NOTREACHED(); 52 NOTREACHED();
53 return std::wstring(); 53 return std::wstring();
54 } 54 }
55 virtual std::wstring GetWindowTitle() const { 55 virtual std::wstring GetWindowTitle() const {
56 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); 56 return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
57 } 57 }
58 virtual bool Accept() { 58 virtual bool Accept() {
59 advanced_page_view_->ResetToDefaults(); 59 advanced_page_view_->ResetToDefaults();
60 return true; 60 return true;
61 } 61 }
62 // views::WindowDelegate 62 // views::WindowDelegate
63 virtual void DeleteDelegate() { delete this; } 63 virtual void DeleteDelegate() { delete this; }
64 virtual bool IsModal() const { return true; } 64 virtual bool IsModal() const { return true; }
65 virtual views::View* GetContentsView() { return message_box_view_; } 65 virtual views::View* GetContentsView() { return message_box_view_; }
66 66
67 private: 67 private:
68 ResetDefaultsConfirmBox(HWND parent_hwnd, AdvancedPageView* page_view) 68 ResetDefaultsConfirmBox(HWND parent_hwnd, AdvancedPageView* page_view)
69 : advanced_page_view_(page_view) { 69 : advanced_page_view_(page_view) {
70 int dialog_width = views::Window::GetLocalizedContentsWidth( 70 int dialog_width = views::Window::GetLocalizedContentsWidth(
71 IDS_OPTIONS_RESET_CONFIRM_BOX_WIDTH_CHARS); 71 IDS_OPTIONS_RESET_CONFIRM_BOX_WIDTH_CHARS);
72 // Also deleted when the window closes. 72 // Also deleted when the window closes.
73 message_box_view_ = new MessageBoxView( 73 message_box_view_ = new MessageBoxView(
74 MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton, 74 ui::MessageBoxFlags::kFlagHasMessage |
75 ui::MessageBoxFlags::kFlagHasOKButton,
75 UTF16ToWide( 76 UTF16ToWide(
76 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_MESSAGE)).c_str(), 77 l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_MESSAGE)).c_str(),
77 std::wstring(), 78 std::wstring(),
78 dialog_width); 79 dialog_width);
79 views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this)->Show(); 80 views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this)->Show();
80 } 81 }
81 virtual ~ResetDefaultsConfirmBox() { } 82 virtual ~ResetDefaultsConfirmBox() { }
82 83
83 MessageBoxView* message_box_view_; 84 MessageBoxView* message_box_view_;
84 AdvancedPageView* advanced_page_view_; 85 AdvancedPageView* advanced_page_view_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 new ManagedPrefsBannerView(profile()->GetPrefs(), OPTIONS_PAGE_ADVANCED)); 141 new ManagedPrefsBannerView(profile()->GetPrefs(), OPTIONS_PAGE_ADVANCED));
141 142
142 layout->StartRow(1, single_column_view_set_id); 143 layout->StartRow(1, single_column_view_set_id);
143 layout->AddView(advanced_scroll_view_); 144 layout->AddView(advanced_scroll_view_);
144 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); 145 layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
145 146
146 layout->StartRow(0, single_column_view_set_id); 147 layout->StartRow(0, single_column_view_set_id);
147 layout->AddView(reset_to_default_button_, 1, 1, 148 layout->AddView(reset_to_default_button_, 1, 1,
148 GridLayout::TRAILING, GridLayout::CENTER); 149 GridLayout::TRAILING, GridLayout::CENTER);
149 } 150 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.cc ('k') | chrome/browser/ui/views/options/passwords_page_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698