OLD | NEW |
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/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 "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 static const int kDialogPadding = 7; | 82 static const int kDialogPadding = 7; |
83 | 83 |
84 /////////////////////////////////////////////////////////////////////////////// | 84 /////////////////////////////////////////////////////////////////////////////// |
85 // OptionsWindowView, public: | 85 // OptionsWindowView, public: |
86 | 86 |
87 OptionsWindowView::OptionsWindowView(Profile* profile) | 87 OptionsWindowView::OptionsWindowView(Profile* profile) |
88 // Always show preferences for the original profile. Most state when off | 88 // Always show preferences for the original profile. Most state when off |
89 // the record comes from the original profile, but we explicitly use | 89 // the record comes from the original profile, but we explicitly use |
90 // the original profile to avoid potential problems. | 90 // the original profile to avoid potential problems. |
91 : profile_(profile->GetOriginalProfile()) { | 91 : profile_(profile->GetOriginalProfile()) { |
92 // The download manager needs to be initialized before the contents of the | |
93 // Options Window are created. | |
94 profile_->GetDownloadManager(); | |
95 // We don't need to observe changes in this value. | 92 // We don't need to observe changes in this value. |
96 last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex, | 93 last_selected_page_.Init(prefs::kOptionsWindowLastTabIndex, |
97 g_browser_process->local_state(), NULL); | 94 g_browser_process->local_state(), NULL); |
98 } | 95 } |
99 | 96 |
100 OptionsWindowView::~OptionsWindowView() { | 97 OptionsWindowView::~OptionsWindowView() { |
101 } | 98 } |
102 | 99 |
103 void OptionsWindowView::ShowOptionsPage(OptionsPage page, | 100 void OptionsWindowView::ShowOptionsPage(OptionsPage page, |
104 OptionsGroup highlight_group) { | 101 OptionsGroup highlight_group) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // the specified page. | 218 // the specified page. |
222 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care | 219 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care |
223 // about this case this will have to be fixed. | 220 // about this case this will have to be fixed. |
224 if (!instance_) { | 221 if (!instance_) { |
225 instance_ = new OptionsWindowView(profile); | 222 instance_ = new OptionsWindowView(profile); |
226 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); | 223 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); |
227 // The window is alive by itself now... | 224 // The window is alive by itself now... |
228 } | 225 } |
229 instance_->ShowOptionsPage(page, highlight_group); | 226 instance_->ShowOptionsPage(page, highlight_group); |
230 } | 227 } |
OLD | NEW |