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

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

Issue 155668: Refactoring of tabbed-pane component so it can be ported to Linux toolkit_view (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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) 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"
11 #include "chrome/browser/views/options/advanced_page_view.h" 11 #include "chrome/browser/views/options/advanced_page_view.h"
12 #include "chrome/browser/views/options/content_page_view.h" 12 #include "chrome/browser/views/options/content_page_view.h"
13 #include "chrome/browser/views/options/general_page_view.h" 13 #include "chrome/browser/views/options/general_page_view.h"
14 #include "chrome/common/chrome_constants.h" 14 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/common/pref_service.h" 16 #include "chrome/common/pref_service.h"
17 #ifdef CHROME_PERSONALIZATION 17 #ifdef CHROME_PERSONALIZATION
18 #include "chrome/personalization/personalization.h" 18 #include "chrome/personalization/personalization.h"
19 #include "chrome/personalization/views/user_data_page_view.h" 19 #include "chrome/personalization/views/user_data_page_view.h"
20 #endif 20 #endif
21 #include "grit/chromium_strings.h" 21 #include "grit/chromium_strings.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "grit/locale_settings.h" 23 #include "grit/locale_settings.h"
24 #include "views/controls/tabbed_pane.h" 24 #include "views/controls/tabbed_pane/tabbed_pane.h"
25 #include "views/widget/root_view.h" 25 #include "views/widget/root_view.h"
26 #include "views/window/dialog_delegate.h" 26 #include "views/window/dialog_delegate.h"
27 #include "views/window/window.h" 27 #include "views/window/window.h"
28 28
29 /////////////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////////////
30 // OptionsWindowView 30 // OptionsWindowView
31 // 31 //
32 // The contents of the Options dialog window. 32 // The contents of the Options dialog window.
33 // 33 //
34 class OptionsWindowView : public views::View, 34 class OptionsWindowView : public views::View,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 AdvancedPageView* advanced_page = new AdvancedPageView(profile_); 214 AdvancedPageView* advanced_page = new AdvancedPageView(profile_);
215 tabs_->AddTabAtIndex(tab_index++, 215 tabs_->AddTabAtIndex(tab_index++,
216 l10n_util::GetString(IDS_OPTIONS_ADVANCED_TAB_LABEL), 216 l10n_util::GetString(IDS_OPTIONS_ADVANCED_TAB_LABEL),
217 advanced_page, false); 217 advanced_page, false);
218 218
219 DCHECK(tabs_->GetTabCount() == OPTIONS_PAGE_COUNT); 219 DCHECK(tabs_->GetTabCount() == OPTIONS_PAGE_COUNT);
220 } 220 }
221 221
222 OptionsPageView* OptionsWindowView::GetCurrentOptionsPageView() const { 222 OptionsPageView* OptionsWindowView::GetCurrentOptionsPageView() const {
223 views::RootView* contents_root_view = tabs_->GetContentsRootView(); 223 return static_cast<OptionsPageView*>(tabs_->GetSelectedTab());
224 DCHECK(contents_root_view->GetChildViewCount() == 1);
225 return static_cast<OptionsPageView*>(contents_root_view->GetChildViewAt(0));
226 } 224 }
227 225
228 /////////////////////////////////////////////////////////////////////////////// 226 ///////////////////////////////////////////////////////////////////////////////
229 // Factory/finder method: 227 // Factory/finder method:
230 228
231 void ShowOptionsWindow(OptionsPage page, 229 void ShowOptionsWindow(OptionsPage page,
232 OptionsGroup highlight_group, 230 OptionsGroup highlight_group,
233 Profile* profile) { 231 Profile* profile) {
234 DCHECK(profile); 232 DCHECK(profile);
235 // If there's already an existing options window, activate it and switch to 233 // If there's already an existing options window, activate it and switch to
236 // the specified page. 234 // the specified page.
237 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care 235 // TODO(beng): note this is not multi-simultaneous-profile-safe. When we care
238 // about this case this will have to be fixed. 236 // about this case this will have to be fixed.
239 if (!instance_) { 237 if (!instance_) {
240 instance_ = new OptionsWindowView(profile); 238 instance_ = new OptionsWindowView(profile);
241 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_); 239 views::Window::CreateChromeWindow(NULL, gfx::Rect(), instance_);
242 // The window is alive by itself now... 240 // The window is alive by itself now...
243 } 241 }
244 instance_->ShowOptionsPage(page, highlight_group); 242 instance_->ShowOptionsPage(page, highlight_group);
245 } 243 }
OLDNEW
« no previous file with comments | « chrome/browser/views/options/languages_page_view.cc ('k') | chrome/browser/views/options/passwords_exceptions_window_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698