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

Side by Side Diff: chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gtk/tabs/dragged_tab_controller_gtk.h" 5 #include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/callback_old.h" 9 #include "base/callback_old.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 content::JavaScriptDialogCreator* 159 content::JavaScriptDialogCreator*
160 DraggedTabControllerGtk::GetJavaScriptDialogCreator() { 160 DraggedTabControllerGtk::GetJavaScriptDialogCreator() {
161 return GetJavaScriptDialogCreatorInstance(); 161 return GetJavaScriptDialogCreatorInstance();
162 } 162 }
163 163
164 //////////////////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////////////////
165 // DraggedTabControllerGtk, NotificationObserver implementation: 165 // DraggedTabControllerGtk, NotificationObserver implementation:
166 166
167 void DraggedTabControllerGtk::Observe(NotificationType type, 167 void DraggedTabControllerGtk::Observe(int type,
168 const NotificationSource& source, 168 const NotificationSource& source,
169 const NotificationDetails& details) { 169 const NotificationDetails& details) {
170 DCHECK(type == NotificationType::TAB_CONTENTS_DESTROYED); 170 DCHECK(type == content::NOTIFICATION_TAB_CONTENTS_DESTROYED);
171 DCHECK_EQ(Source<TabContents>(source).ptr(), 171 DCHECK_EQ(Source<TabContents>(source).ptr(),
172 dragged_contents_->tab_contents()); 172 dragged_contents_->tab_contents());
173 EndDragImpl(TAB_DESTROYED); 173 EndDragImpl(TAB_DESTROYED);
174 } 174 }
175 175
176 void DraggedTabControllerGtk::InitWindowCreatePoint() { 176 void DraggedTabControllerGtk::InitWindowCreatePoint() {
177 window_create_point_.SetPoint(mouse_offset_.x(), mouse_offset_.y()); 177 window_create_point_.SetPoint(mouse_offset_.x(), mouse_offset_.y());
178 } 178 }
179 179
180 gfx::Point DraggedTabControllerGtk::GetWindowCreatePoint() const { 180 gfx::Point DraggedTabControllerGtk::GetWindowCreatePoint() const {
181 gfx::Point cursor_point = GetCursorScreenPoint(); 181 gfx::Point cursor_point = GetCursorScreenPoint();
182 return gfx::Point(cursor_point.x() - window_create_point_.x(), 182 return gfx::Point(cursor_point.x() - window_create_point_.x(),
183 cursor_point.y() - window_create_point_.y()); 183 cursor_point.y() - window_create_point_.y());
184 } 184 }
185 185
186 void DraggedTabControllerGtk::SetDraggedContents( 186 void DraggedTabControllerGtk::SetDraggedContents(
187 TabContentsWrapper* new_contents) { 187 TabContentsWrapper* new_contents) {
188 if (dragged_contents_) { 188 if (dragged_contents_) {
189 registrar_.Remove(this, 189 registrar_.Remove(this,
190 NotificationType::TAB_CONTENTS_DESTROYED, 190 content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
191 Source<TabContents>(dragged_contents_->tab_contents())); 191 Source<TabContents>(dragged_contents_->tab_contents()));
192 if (original_delegate_) 192 if (original_delegate_)
193 dragged_contents_->tab_contents()->set_delegate(original_delegate_); 193 dragged_contents_->tab_contents()->set_delegate(original_delegate_);
194 } 194 }
195 original_delegate_ = NULL; 195 original_delegate_ = NULL;
196 dragged_contents_ = new_contents; 196 dragged_contents_ = new_contents;
197 if (dragged_contents_) { 197 if (dragged_contents_) {
198 registrar_.Add(this, 198 registrar_.Add(this,
199 NotificationType::TAB_CONTENTS_DESTROYED, 199 content::NOTIFICATION_TAB_CONTENTS_DESTROYED,
200 Source<TabContents>(dragged_contents_->tab_contents())); 200 Source<TabContents>(dragged_contents_->tab_contents()));
201 201
202 // We need to be the delegate so we receive messages about stuff, 202 // We need to be the delegate so we receive messages about stuff,
203 // otherwise our dragged_contents() may be replaced and subsequently 203 // otherwise our dragged_contents() may be replaced and subsequently
204 // collected/destroyed while the drag is in process, leading to 204 // collected/destroyed while the drag is in process, leading to
205 // nasty crashes. 205 // nasty crashes.
206 original_delegate_ = dragged_contents_->tab_contents()->delegate(); 206 original_delegate_ = dragged_contents_->tab_contents()->delegate();
207 dragged_contents_->tab_contents()->set_delegate(this); 207 dragged_contents_->tab_contents()->set_delegate(this);
208 } 208 }
209 } 209 }
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 gfx::NativeView dragged_tab = dragged_tab_->widget(); 760 gfx::NativeView dragged_tab = dragged_tab_->widget();
761 dock_windows_.insert(dragged_tab); 761 dock_windows_.insert(dragged_tab);
762 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(), 762 window = DockInfo::GetLocalProcessWindowAtPoint(GetCursorScreenPoint(),
763 dock_windows_); 763 dock_windows_);
764 dock_windows_.erase(dragged_tab); 764 dock_windows_.erase(dragged_tab);
765 } 765 }
766 766
767 if (window) 767 if (window)
768 gtk_window_present(GTK_WINDOW(window)); 768 gtk_window_present(GTK_WINDOW(window));
769 } 769 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h ('k') | chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698