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

Side by Side Diff: chrome/browser/gtk/constrained_window_gtk.cc

Issue 132047: GTK: HTTP Auth dialogs under linux. (Closed)
Patch Set: Fix for evanm Created 11 years, 6 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
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gtk/constrained_window_gtk.h"
6
7 #include "chrome/browser/tab_contents/tab_contents.h"
8 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h"
9 #include "chrome/common/gtk_util.h"
10
11 // The minimal border around the edge of the notification.
12 const int kSmallPadding = 2;
13
14 ConstrainedWindowGtk::ConstrainedWindowGtk(
15 TabContents* owner, ConstrainedWindowGtkDelegate* delegate)
16 : owner_(owner),
17 delegate_(delegate) {
18 DCHECK(owner);
19 DCHECK(delegate);
20 GtkWidget* dialog = delegate->GetWidgetRoot();
21
22 // Unlike other users of CreateBorderBin, we need a dedicated frame around
23 // our "window".
24 GtkWidget* ebox = gtk_event_box_new();
25 GtkWidget* frame = gtk_frame_new(NULL);
26 gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
27 GtkWidget* alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
28 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
29 kSmallPadding, kSmallPadding, kSmallPadding, kSmallPadding);
30 gtk_container_add(GTK_CONTAINER(alignment), dialog);
31 gtk_container_add(GTK_CONTAINER(frame), alignment);
32 gtk_container_add(GTK_CONTAINER(ebox), frame);
33 border_.Own(ebox);
34
35 gtk_widget_show_all(border_.get());
36
37 // We collaborate with TabContentsViewGtk and stick ourselves in the
38 // TabContentsViewGtk's floating container.
39 ContainingView()->AttachConstrainedWindow(this);
40 }
41
42 ConstrainedWindowGtk::~ConstrainedWindowGtk() {
43 border_.Destroy();
44 }
45
46 void ConstrainedWindowGtk::CloseConstrainedWindow() {
47 ContainingView()->RemoveConstrainedWindow(this);
48 delegate_->DeleteDelegate();
49 owner_->WillClose(this);
50
51 delete this;
52 }
53
54 TabContentsViewGtk* ConstrainedWindowGtk::ContainingView() {
55 return static_cast<TabContentsViewGtk*>(owner_->view());
56 }
57
58 // static
59 ConstrainedWindow* ConstrainedWindow::CreateConstrainedDialog(
60 TabContents* parent,
61 ConstrainedWindowGtkDelegate* delegate) {
62 return new ConstrainedWindowGtk(parent, delegate);
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698