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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_gtk.cc

Issue 392018: Enforce that only one constrained window is displayed at once per tab. (Closed)
Patch Set: Set focus correctly on linux Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_gtk.h ('k') | chrome/browser/views/constrained_window_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents_view_gtk.cc
diff --git a/chrome/browser/tab_contents/tab_contents_view_gtk.cc b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
index 332c7cd852e5db7158cfc15d265e74092670adf5..736dcac708578035f4a0fa8ad846c7ade868d99b 100644
--- a/chrome/browser/tab_contents/tab_contents_view_gtk.cc
+++ b/chrome/browser/tab_contents/tab_contents_view_gtk.cc
@@ -119,7 +119,8 @@ TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents)
: TabContentsView(tab_contents),
floating_(gtk_floating_container_new()),
fixed_(gtk_fixed_new()),
- popup_view_(NULL) {
+ popup_view_(NULL),
+ constrained_window_(NULL) {
gtk_widget_set_name(fixed_, "chrome-tab-contents-view");
g_signal_connect(fixed_, "size-allocate",
G_CALLBACK(OnSizeAllocate), this);
@@ -155,24 +156,20 @@ void TabContentsViewGtk::RemoveBlockedPopupView(
void TabContentsViewGtk::AttachConstrainedWindow(
ConstrainedWindowGtk* constrained_window) {
- DCHECK(find(constrained_windows_.begin(), constrained_windows_.end(),
- constrained_window) == constrained_windows_.end());
+ DCHECK(constrained_window_ == NULL);
- constrained_windows_.push_back(constrained_window);
+ constrained_window_ = constrained_window;
gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
constrained_window->widget());
}
void TabContentsViewGtk::RemoveConstrainedWindow(
ConstrainedWindowGtk* constrained_window) {
- std::vector<ConstrainedWindowGtk*>::iterator item =
- find(constrained_windows_.begin(), constrained_windows_.end(),
- constrained_window);
- DCHECK(item != constrained_windows_.end());
+ DCHECK(constrained_window == constrained_window_);
+ constrained_window_ = NULL;
gtk_container_remove(GTK_CONTAINER(floating_.get()),
constrained_window->widget());
- constrained_windows_.erase(item);
}
void TabContentsViewGtk::CreateView(const gfx::Size& initial_size) {
@@ -450,15 +447,11 @@ void TabContentsViewGtk::OnSetFloatingPosition(
g_value_unset(&value);
}
- // Place each ConstrainedWindow in the center of the view.
+ // Place the ConstrainedWindow in the center of the view.
int half_view_width = std::max((allocation->x + allocation->width) / 2, 0);
int half_view_height = std::max((allocation->y + allocation->height) / 2, 0);
- std::vector<ConstrainedWindowGtk*>::iterator it =
- tab_contents_view->constrained_windows_.begin();
- std::vector<ConstrainedWindowGtk*>::iterator end =
- tab_contents_view->constrained_windows_.end();
- for (; it != end; ++it) {
- GtkWidget* widget = (*it)->widget();
+ if (tab_contents_view->constrained_window_) {
+ GtkWidget* widget = tab_contents_view->constrained_window_->widget();
DCHECK(widget->parent == tab_contents_view->floating_.get());
GtkRequisition requisition;
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_view_gtk.h ('k') | chrome/browser/views/constrained_window_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698