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

Side by Side Diff: chrome/browser/ui/sad_tab_helper.cc

Issue 9705053: Remove tab_contents_view_gtk.h include from chrome. I tried to find a way to not have to expose the… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/sad_tab_helper.h" 5 #include "chrome/browser/ui/sad_tab_helper.h"
6 6
7 #include "chrome/browser/browser_shutdown.h" 7 #include "chrome/browser/browser_shutdown.h"
8 #include "content/public/browser/notification_source.h" 8 #include "content/public/browser/notification_source.h"
9 #include "content/public/browser/notification_types.h" 9 #include "content/public/browser/notification_types.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h" 11 #include "content/public/browser/web_contents_view.h"
12 12
13 #if defined(OS_MACOSX) 13 #if defined(OS_MACOSX)
14 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 14 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
15 #elif defined(TOOLKIT_VIEWS) 15 #elif defined(TOOLKIT_VIEWS)
16 #include "chrome/browser/ui/views/sad_tab_view.h" 16 #include "chrome/browser/ui/views/sad_tab_view.h"
17 #include "ui/views/widget/widget.h" 17 #include "ui/views/widget/widget.h"
18 #elif defined(TOOLKIT_GTK) 18 #elif defined(TOOLKIT_GTK)
19 19
20 #include <gtk/gtk.h> 20 #include <gtk/gtk.h>
21 21
22 #include "content/browser/tab_contents/tab_contents_view_gtk.h" 22 #include "chrome/browser/tab_contents/chrome_web_contents_view_delegate_gtk.h"
23 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" 23 #include "chrome/browser/ui/gtk/sad_tab_gtk.h"
24 #endif 24 #endif
25 25
26 using content::WebContents; 26 using content::WebContents;
27 27
28 SadTabHelper::SadTabHelper(WebContents* web_contents) 28 SadTabHelper::SadTabHelper(WebContents* web_contents)
29 : content::WebContentsObserver(web_contents) { 29 : content::WebContentsObserver(web_contents) {
30 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, 30 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
31 content::Source<WebContents>(web_contents)); 31 content::Source<WebContents>(web_contents));
32 } 32 }
(...skipping 18 matching lines...) Expand all
51 const content::NotificationSource& source, 51 const content::NotificationSource& source,
52 const content::NotificationDetails& details) { 52 const content::NotificationDetails& details) {
53 switch (type) { 53 switch (type) {
54 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED: 54 case content::NOTIFICATION_WEB_CONTENTS_CONNECTED:
55 if (HasSadTab()) { 55 if (HasSadTab()) {
56 #if defined(OS_MACOSX) 56 #if defined(OS_MACOSX)
57 sad_tab_controller_mac::RemoveSadTab(sad_tab_.get()); 57 sad_tab_controller_mac::RemoveSadTab(sad_tab_.get());
58 #elif defined(TOOLKIT_VIEWS) 58 #elif defined(TOOLKIT_VIEWS)
59 sad_tab_->Close(); 59 sad_tab_->Close();
60 #elif defined(TOOLKIT_GTK) 60 #elif defined(TOOLKIT_GTK)
61 content::TabContentsViewGtk* view = 61 GtkWidget* expanded_container =
62 static_cast<content::TabContentsViewGtk*>( 62 ChromeWebContentsViewDelegateGtk::GetFor(web_contents())->
63 web_contents()->GetView()); 63 expanded_container();
64 gtk_container_remove( 64 gtk_container_remove(
65 GTK_CONTAINER(view->expanded_container()), sad_tab_->widget()); 65 GTK_CONTAINER(expanded_container), sad_tab_->widget());
66 #else 66 #else
67 #error Unknown platform 67 #error Unknown platform
68 #endif 68 #endif
69 sad_tab_.reset(); 69 sad_tab_.reset();
70 } 70 }
71 break; 71 break;
72 72
73 default: 73 default:
74 NOTREACHED() << "Got a notification we didn't register for."; 74 NOTREACHED() << "Got a notification we didn't register for.";
75 } 75 }
(...skipping 23 matching lines...) Expand all
99 sad_tab_->GetNativeView(), web_contents()->GetView()->GetNativeView()); 99 sad_tab_->GetNativeView(), web_contents()->GetView()->GetNativeView());
100 gfx::Rect bounds; 100 gfx::Rect bounds;
101 web_contents()->GetView()->GetContainerBounds(&bounds); 101 web_contents()->GetView()->GetContainerBounds(&bounds);
102 sad_tab_->SetBounds(gfx::Rect(bounds.size())); 102 sad_tab_->SetBounds(gfx::Rect(bounds.size()));
103 #elif defined(TOOLKIT_GTK) 103 #elif defined(TOOLKIT_GTK)
104 sad_tab_.reset(new SadTabGtk( 104 sad_tab_.reset(new SadTabGtk(
105 web_contents(), 105 web_contents(),
106 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED 106 status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED
107 ? SadTabGtk::KILLED 107 ? SadTabGtk::KILLED
108 : SadTabGtk::CRASHED)); 108 : SadTabGtk::CRASHED));
109 content::TabContentsViewGtk* view = 109 GtkWidget* expanded_container =
110 static_cast<content::TabContentsViewGtk*>(web_contents()->GetView()); 110 ChromeWebContentsViewDelegateGtk::GetFor(web_contents())->
111 gtk_container_add( 111 expanded_container();
112 GTK_CONTAINER(view->expanded_container()), sad_tab_->widget()); 112 gtk_container_add(GTK_CONTAINER(expanded_container), sad_tab_->widget());
113 gtk_widget_show(sad_tab_->widget()); 113 gtk_widget_show(sad_tab_->widget());
114 #else 114 #else
115 #error Unknown platform 115 #error Unknown platform
116 #endif 116 #endif
117 } 117 }
118 118
119 bool SadTabHelper::HasSadTab() { 119 bool SadTabHelper::HasSadTab() {
120 return sad_tab_.get() != NULL; 120 return sad_tab_.get() != NULL;
121 } 121 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/constrained_window_gtk.cc ('k') | content/browser/tab_contents/tab_contents_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698