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

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

Issue 10993064: Make using WebContentsUserData simpler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 2 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/browser_shutdown.h" 8 #include "chrome/browser/browser_shutdown.h"
9 #include "chrome/browser/ui/sad_tab_types.h" 9 #include "chrome/browser/ui/sad_tab_types.h"
10 #include "content/public/browser/notification_source.h" 10 #include "content/public/browser/notification_source.h"
11 #include "content/public/browser/notification_types.h" 11 #include "content/public/browser/notification_types.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "content/public/browser/web_contents_view.h" 13 #include "content/public/browser/web_contents_view.h"
14 14
15 #if defined(OS_MACOSX) 15 #if defined(OS_MACOSX)
16 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h" 16 #include "chrome/browser/ui/cocoa/tab_contents/sad_tab_controller.h"
17 #elif defined(TOOLKIT_VIEWS) 17 #elif defined(TOOLKIT_VIEWS)
18 #include "chrome/browser/ui/views/sad_tab_view.h" 18 #include "chrome/browser/ui/views/sad_tab_view.h"
19 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
20 #elif defined(TOOLKIT_GTK) 20 #elif defined(TOOLKIT_GTK)
21 #include <gtk/gtk.h> 21 #include <gtk/gtk.h>
22 22
23 #include "chrome/browser/ui/gtk/sad_tab_gtk.h" 23 #include "chrome/browser/ui/gtk/sad_tab_gtk.h"
24 #include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_g tk.h" 24 #include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_g tk.h"
25 #endif 25 #endif
26 26
27 int SadTabHelper::kUserDataKey; 27 DEFINE_WEB_CONTENTS_USER_DATA_KEY(SadTabHelper)
28 28
29 SadTabHelper::SadTabHelper(content::WebContents* web_contents) 29 SadTabHelper::SadTabHelper(content::WebContents* web_contents)
30 : content::WebContentsObserver(web_contents) { 30 : content::WebContentsObserver(web_contents) {
31 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED, 31 registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_CONNECTED,
32 content::Source<content::WebContents>(web_contents)); 32 content::Source<content::WebContents>(web_contents));
33 } 33 }
34 34
35 SadTabHelper::~SadTabHelper() { 35 SadTabHelper::~SadTabHelper() {
36 } 36 }
37 37
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 sad_tab_.reset(new SadTabGtk(web_contents(), kind)); 127 sad_tab_.reset(new SadTabGtk(web_contents(), kind));
128 GtkWidget* expanded_container = 128 GtkWidget* expanded_container =
129 ChromeWebContentsViewDelegateGtk::GetFor(web_contents())-> 129 ChromeWebContentsViewDelegateGtk::GetFor(web_contents())->
130 expanded_container(); 130 expanded_container();
131 gtk_container_add(GTK_CONTAINER(expanded_container), sad_tab_->widget()); 131 gtk_container_add(GTK_CONTAINER(expanded_container), sad_tab_->widget());
132 gtk_widget_show(sad_tab_->widget()); 132 gtk_widget_show(sad_tab_->widget());
133 #else 133 #else
134 #error Unknown platform 134 #error Unknown platform
135 #endif 135 #endif
136 } 136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698