| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/options_window.h" | 5 #include "chrome/browser/options_window.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/browser/browser_list.h" | 9 #include "chrome/browser/browser_list.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/browser_window.h" | 11 #include "chrome/browser/browser_window.h" |
| 12 #include "chrome/browser/chromeos/options/internet_page_view.h" | 12 #include "chrome/browser/chromeos/options/internet_page_view.h" |
| 13 #include "chrome/browser/chromeos/options/system_page_view.h" | 13 #include "chrome/browser/chromeos/options/system_page_view.h" |
| 14 #include "chrome/browser/gtk/options/advanced_page_gtk.h" | 14 #include "chrome/browser/gtk/options/advanced_page_gtk.h" |
| 15 #include "chrome/browser/gtk/options/content_page_gtk.h" | 15 #include "chrome/browser/gtk/options/content_page_gtk.h" |
| 16 #include "chrome/browser/gtk/options/general_page_gtk.h" | 16 #include "chrome/browser/gtk/options/general_page_gtk.h" |
| 17 #include "chrome/browser/pref_service.h" | 17 #include "chrome/browser/pref_service.h" |
| 18 #include "chrome/browser/profile.h" | 18 #include "chrome/browser/profile.h" |
| 19 #include "chrome/browser/views/accessible_view_helper.h" |
| 19 #include "chrome/browser/window_sizer.h" | 20 #include "chrome/browser/window_sizer.h" |
| 20 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 22 #include "grit/chromium_strings.h" | 23 #include "grit/chromium_strings.h" |
| 23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
| 24 #include "grit/locale_settings.h" | 25 #include "grit/locale_settings.h" |
| 25 #include "views/controls/native/native_view_host.h" | 26 #include "views/controls/native/native_view_host.h" |
| 26 #include "views/controls/tabbed_pane/native_tabbed_pane_gtk.h" | 27 #include "views/controls/tabbed_pane/native_tabbed_pane_gtk.h" |
| 27 #include "views/controls/tabbed_pane/tabbed_pane.h" | 28 #include "views/controls/tabbed_pane/tabbed_pane.h" |
| 28 #include "views/widget/root_view.h" | 29 #include "views/widget/root_view.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 Profile* profile_; | 136 Profile* profile_; |
| 136 | 137 |
| 137 // Native Gtk options pages. | 138 // Native Gtk options pages. |
| 138 GeneralPageGtk general_page_; | 139 GeneralPageGtk general_page_; |
| 139 ContentPageGtk content_page_; | 140 ContentPageGtk content_page_; |
| 140 AdvancedPageGtk advanced_page_; | 141 AdvancedPageGtk advanced_page_; |
| 141 | 142 |
| 142 // The last page the user was on when they opened the Options window. | 143 // The last page the user was on when they opened the Options window. |
| 143 IntegerPrefMember last_selected_page_; | 144 IntegerPrefMember last_selected_page_; |
| 144 | 145 |
| 146 scoped_ptr<AccessibleViewHelper> accessible_view_helper_; |
| 147 |
| 145 DISALLOW_IMPLICIT_CONSTRUCTORS(OptionsWindowView); | 148 DISALLOW_IMPLICIT_CONSTRUCTORS(OptionsWindowView); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 /////////////////////////////////////////////////////////////////////////////// | 151 /////////////////////////////////////////////////////////////////////////////// |
| 149 // OptionsWindowView, public: | 152 // OptionsWindowView, public: |
| 150 | 153 |
| 151 // No dialog padding. | 154 // No dialog padding. |
| 152 const int OptionsWindowView::kDialogPadding = 0; | 155 const int OptionsWindowView::kDialogPadding = 0; |
| 153 | 156 |
| 154 // Shaded frame color that matches the rendered frame. It's the result | 157 // Shaded frame color that matches the rendered frame. It's the result |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 last_selected_page_.SetValue(index); | 248 last_selected_page_.SetValue(index); |
| 246 } | 249 } |
| 247 | 250 |
| 248 /////////////////////////////////////////////////////////////////////////////// | 251 /////////////////////////////////////////////////////////////////////////////// |
| 249 // OptionsWindowView, views::View overrides: | 252 // OptionsWindowView, views::View overrides: |
| 250 | 253 |
| 251 void OptionsWindowView::Layout() { | 254 void OptionsWindowView::Layout() { |
| 252 tabs_->SetBounds(kDialogPadding, kDialogPadding, | 255 tabs_->SetBounds(kDialogPadding, kDialogPadding, |
| 253 width() - (2 * kDialogPadding), | 256 width() - (2 * kDialogPadding), |
| 254 height() - (2 * kDialogPadding)); | 257 height() - (2 * kDialogPadding)); |
| 258 if (!accessible_view_helper_.get()) { |
| 259 accessible_view_helper_.reset(new AccessibleViewHelper(this, profile_)); |
| 260 } |
| 255 } | 261 } |
| 256 | 262 |
| 257 gfx::Size OptionsWindowView::GetPreferredSize() { | 263 gfx::Size OptionsWindowView::GetPreferredSize() { |
| 258 gfx::Size size(tabs_->GetPreferredSize()); | 264 gfx::Size size(tabs_->GetPreferredSize()); |
| 259 size.Enlarge(2 * kDialogPadding, 2 * kDialogPadding); | 265 size.Enlarge(2 * kDialogPadding, 2 * kDialogPadding); |
| 260 return size; | 266 return size; |
| 261 } | 267 } |
| 262 | 268 |
| 263 void OptionsWindowView::ViewHierarchyChanged(bool is_add, | 269 void OptionsWindowView::ViewHierarchyChanged(bool is_add, |
| 264 views::View* parent, | 270 views::View* parent, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // a new one for the current active browser. | 378 // a new one for the current active browser. |
| 373 chromeos::CloseOptionsWindow(); | 379 chromeos::CloseOptionsWindow(); |
| 374 | 380 |
| 375 OptionsWindowView::instance_ = new OptionsWindowView(profile); | 381 OptionsWindowView::instance_ = new OptionsWindowView(profile); |
| 376 views::Window::CreateChromeWindow(chromeos::GetOptionsViewParent(), | 382 views::Window::CreateChromeWindow(chromeos::GetOptionsViewParent(), |
| 377 gfx::Rect(), | 383 gfx::Rect(), |
| 378 OptionsWindowView::instance_); | 384 OptionsWindowView::instance_); |
| 379 | 385 |
| 380 OptionsWindowView::instance_->ShowOptionsPage(page, highlight_group); | 386 OptionsWindowView::instance_->ShowOptionsPage(page, highlight_group); |
| 381 } | 387 } |
| OLD | NEW |