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

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

Issue 27169: Linux: add splash screen (Closed)
Patch Set: ... Created 11 years, 9 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
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 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 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/tab_contents_container_gtk.h" 5 #include "chrome/browser/gtk/tab_contents_container_gtk.h"
6 6
7 #include "base/gfx/native_widget_types.h" 7 #include "base/gfx/native_widget_types.h"
8 #include "chrome/browser/tab_contents/web_contents.h" 8 #include "chrome/browser/tab_contents/web_contents.h"
9 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h" 9 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
10 #include "chrome/common/notification_service.h" 10 #include "chrome/common/notification_service.h"
11 11
12 12
13 TabContentsContainerGtk::TabContentsContainerGtk() 13 TabContentsContainerGtk::TabContentsContainerGtk()
14 : tab_contents_(NULL), 14 : tab_contents_(NULL),
15 vbox_(gtk_vbox_new(FALSE, 0)) { 15 vbox_(gtk_vbox_new(FALSE, 0)) {
16 } 16 }
17 17
18 TabContentsContainerGtk::~TabContentsContainerGtk() { 18 TabContentsContainerGtk::~TabContentsContainerGtk() {
19 if (tab_contents_) 19 if (tab_contents_)
20 RemoveObservers(); 20 RemoveObservers();
21 } 21 }
22 22
23 void TabContentsContainerGtk::AddContainerToBox(GtkWidget* box) { 23 void TabContentsContainerGtk::AddContainerToBox(GtkWidget* box) {
24 gtk_box_pack_start(GTK_BOX(box), vbox_, TRUE, TRUE, 0); 24 gtk_box_pack_start(GTK_BOX(box), vbox_, TRUE, TRUE, 0);
25 } 25 }
26 26
27 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) { 27 void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
28 if (tab_contents_) { 28 if (tab_contents_) {
29 gfx::NativeView widget = tab_contents_->GetNativeView(); 29 gfx::NativeView widget = tab_contents_->GetNativeView();
30 if (widget) { 30 if (widget)
31 gtk_container_remove(GTK_CONTAINER(vbox_), widget); 31 gtk_container_remove(GTK_CONTAINER(vbox_), widget);
32 }
33 32
34 tab_contents_->WasHidden(); 33 tab_contents_->WasHidden();
35 34
36 RemoveObservers(); 35 RemoveObservers();
37 } 36 }
38 37
39 tab_contents_ = tab_contents; 38 tab_contents_ = tab_contents;
40 39
41 // When detaching the last tab of the browser SetTabContents is invoked 40 // When detaching the last tab of the browser SetTabContents is invoked
42 // with NULL. Don't attempt to do anything in that case. 41 // with NULL. Don't attempt to do anything in that case.
43 if (tab_contents_) { 42 if (tab_contents_) {
44 AddObservers(); 43 AddObservers();
45 44
46 gfx::NativeView widget = tab_contents_->GetNativeView(); 45 gfx::NativeView widget = tab_contents_->GetNativeView();
47 if (widget) { 46 if (widget) {
48 gtk_box_pack_start(GTK_BOX(vbox_), widget, TRUE, TRUE, 0); 47 gtk_box_pack_start(GTK_BOX(vbox_), widget, TRUE, TRUE, 0);
48 gtk_widget_show_all(widget);
49 } 49 }
50 } 50 }
51 } 51 }
52 52
53 void TabContentsContainerGtk::Observe(NotificationType type, 53 void TabContentsContainerGtk::Observe(NotificationType type,
54 const NotificationSource& source, 54 const NotificationSource& source,
55 const NotificationDetails& details) { 55 const NotificationDetails& details) {
56 if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) { 56 if (type == NotificationType::RENDER_VIEW_HOST_CHANGED) {
57 RenderViewHostSwitchedDetails* switched_details = 57 RenderViewHostSwitchedDetails* switched_details =
58 Details<RenderViewHostSwitchedDetails>(details).ptr(); 58 Details<RenderViewHostSwitchedDetails>(details).ptr();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // issues, and I'm not entirely convinced that this isn't necessary. 103 // issues, and I'm not entirely convinced that this isn't necessary.
104 } 104 }
105 105
106 void TabContentsContainerGtk::TabContentsDestroyed(TabContents* contents) { 106 void TabContentsContainerGtk::TabContentsDestroyed(TabContents* contents) {
107 // Sometimes, a TabContents is destroyed before we know about it. This allows 107 // Sometimes, a TabContents is destroyed before we know about it. This allows
108 // us to clean up our state in case this happens. 108 // us to clean up our state in case this happens.
109 DCHECK(contents == tab_contents_); 109 DCHECK(contents == tab_contents_);
110 SetTabContents(NULL); 110 SetTabContents(NULL);
111 } 111 }
112 112
OLDNEW
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_view_gtk.cc ('k') | chrome/browser/renderer_host/backing_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698