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/gtk/options/content_settings_window_gtk.h" | 5 #include "chrome/browser/gtk/options/content_settings_window_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL); | 139 g_signal_connect(dialog_, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
140 | 140 |
141 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); | 141 g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this); |
142 } | 142 } |
143 | 143 |
144 ContentSettingsWindowGtk::~ContentSettingsWindowGtk() { | 144 ContentSettingsWindowGtk::~ContentSettingsWindowGtk() { |
145 } | 145 } |
146 | 146 |
147 void ContentSettingsWindowGtk::ShowContentSettingsTab( | 147 void ContentSettingsWindowGtk::ShowContentSettingsTab( |
148 ContentSettingsType page) { | 148 ContentSettingsType page) { |
149 if (Browser* b = BrowserList::GetLastActive()) { | |
150 gtk_util::CenterOverWindow(GTK_WINDOW(dialog_), | |
151 b->window()->GetNativeHandle()); | |
152 } | |
153 | |
154 // Bring options window to front if it already existed and isn't already | 149 // Bring options window to front if it already existed and isn't already |
155 // in front | 150 // in front |
156 gtk_window_present_with_time(GTK_WINDOW(dialog_), | 151 gtk_window_present_with_time(GTK_WINDOW(dialog_), |
157 gtk_get_current_event_time()); | 152 gtk_get_current_event_time()); |
158 | 153 |
159 if (page == CONTENT_SETTINGS_TYPE_DEFAULT) { | 154 if (page == CONTENT_SETTINGS_TYPE_DEFAULT) { |
160 // Remember the last visited page from local state. | 155 // Remember the last visited page from local state. |
161 page = static_cast<ContentSettingsType>(last_selected_page_.GetValue()); | 156 page = static_cast<ContentSettingsType>(last_selected_page_.GetValue()); |
162 if (page == CONTENT_SETTINGS_TYPE_DEFAULT) | 157 if (page == CONTENT_SETTINGS_TYPE_DEFAULT) |
163 page = CONTENT_SETTINGS_TYPE_COOKIES; | 158 page = CONTENT_SETTINGS_TYPE_COOKIES; |
(...skipping 12 matching lines...) Expand all Loading... |
176 int index = page_num; | 171 int index = page_num; |
177 DCHECK(index > CONTENT_SETTINGS_TYPE_DEFAULT && | 172 DCHECK(index > CONTENT_SETTINGS_TYPE_DEFAULT && |
178 index < CONTENT_SETTINGS_NUM_TYPES); | 173 index < CONTENT_SETTINGS_NUM_TYPES); |
179 last_selected_page_.SetValue(index); | 174 last_selected_page_.SetValue(index); |
180 } | 175 } |
181 | 176 |
182 void ContentSettingsWindowGtk::OnWindowDestroy(GtkWidget* widget) { | 177 void ContentSettingsWindowGtk::OnWindowDestroy(GtkWidget* widget) { |
183 settings_window = NULL; | 178 settings_window = NULL; |
184 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 179 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
185 } | 180 } |
OLD | NEW |