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

Side by Side Diff: chrome/browser/ui/views/tab_contents/tab_contents_view_gtk.cc

Issue 5685007: Rename all methods accessing Singleton<T> as GetInstance(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/tab_contents/tab_contents_view_gtk.h" 5 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return new TabContentsViewGtk(tab_contents); 99 return new TabContentsViewGtk(tab_contents);
100 } 100 }
101 101
102 TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents) 102 TabContentsViewGtk::TabContentsViewGtk(TabContents* tab_contents)
103 : TabContentsView(tab_contents), 103 : TabContentsView(tab_contents),
104 views::WidgetGtk(TYPE_CHILD), 104 views::WidgetGtk(TYPE_CHILD),
105 sad_tab_(NULL), 105 sad_tab_(NULL),
106 ignore_next_char_event_(false) { 106 ignore_next_char_event_(false) {
107 drag_source_.reset(new TabContentsDragSource(this)); 107 drag_source_.reset(new TabContentsDragSource(this));
108 last_focused_view_storage_id_ = 108 last_focused_view_storage_id_ =
109 views::ViewStorage::GetSharedInstance()->CreateStorageID(); 109 views::ViewStorage::GetInstance()->CreateStorageID();
110 } 110 }
111 111
112 TabContentsViewGtk::~TabContentsViewGtk() { 112 TabContentsViewGtk::~TabContentsViewGtk() {
113 // Make sure to remove any stored view we may still have in the ViewStorage. 113 // Make sure to remove any stored view we may still have in the ViewStorage.
114 // 114 //
115 // It is possible the view went away before us, so we only do this if the 115 // It is possible the view went away before us, so we only do this if the
116 // view is registered. 116 // view is registered.
117 views::ViewStorage* view_storage = views::ViewStorage::GetSharedInstance(); 117 views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
118 if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL) 118 if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
119 view_storage->RemoveView(last_focused_view_storage_id_); 119 view_storage->RemoveView(last_focused_view_storage_id_);
120 120
121 // Just deleting the object doesn't destroy the GtkWidget. We need to do that 121 // Just deleting the object doesn't destroy the GtkWidget. We need to do that
122 // manually, and synchronously, since subsequent signal handlers may expect 122 // manually, and synchronously, since subsequent signal handlers may expect
123 // to locate this object. 123 // to locate this object.
124 CloseNow(); 124 CloseNow();
125 } 125 }
126 126
127 void TabContentsViewGtk::AttachConstrainedWindow( 127 void TabContentsViewGtk::AttachConstrainedWindow(
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 void TabContentsViewGtk::SetInitialFocus() { 272 void TabContentsViewGtk::SetInitialFocus() {
273 if (tab_contents()->FocusLocationBarByDefault()) 273 if (tab_contents()->FocusLocationBarByDefault())
274 tab_contents()->SetFocusToLocationBar(false); 274 tab_contents()->SetFocusToLocationBar(false);
275 else 275 else
276 Focus(); 276 Focus();
277 } 277 }
278 278
279 void TabContentsViewGtk::StoreFocus() { 279 void TabContentsViewGtk::StoreFocus() {
280 views::ViewStorage* view_storage = views::ViewStorage::GetSharedInstance(); 280 views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
281 281
282 if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL) 282 if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
283 view_storage->RemoveView(last_focused_view_storage_id_); 283 view_storage->RemoveView(last_focused_view_storage_id_);
284 284
285 views::FocusManager* focus_manager = 285 views::FocusManager* focus_manager =
286 views::FocusManager::GetFocusManagerForNativeView(GetNativeView()); 286 views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
287 if (focus_manager) { 287 if (focus_manager) {
288 // |focus_manager| can be NULL if the tab has been detached but still 288 // |focus_manager| can be NULL if the tab has been detached but still
289 // exists. 289 // exists.
290 views::View* focused_view = focus_manager->GetFocusedView(); 290 views::View* focused_view = focus_manager->GetFocusedView();
291 if (focused_view) 291 if (focused_view)
292 view_storage->StoreView(last_focused_view_storage_id_, focused_view); 292 view_storage->StoreView(last_focused_view_storage_id_, focused_view);
293 } 293 }
294 } 294 }
295 295
296 void TabContentsViewGtk::RestoreFocus() { 296 void TabContentsViewGtk::RestoreFocus() {
297 views::ViewStorage* view_storage = views::ViewStorage::GetSharedInstance(); 297 views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
298 views::View* last_focused_view = 298 views::View* last_focused_view =
299 view_storage->RetrieveView(last_focused_view_storage_id_); 299 view_storage->RetrieveView(last_focused_view_storage_id_);
300 if (!last_focused_view) { 300 if (!last_focused_view) {
301 SetInitialFocus(); 301 SetInitialFocus();
302 } else { 302 } else {
303 views::FocusManager* focus_manager = 303 views::FocusManager* focus_manager =
304 views::FocusManager::GetFocusManagerForNativeView(GetNativeView()); 304 views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
305 305
306 // If you hit this DCHECK, please report it to Jay (jcampan). 306 // If you hit this DCHECK, please report it to Jay (jcampan).
307 DCHECK(focus_manager != NULL) << "No focus manager when restoring focus."; 307 DCHECK(focus_manager != NULL) << "No focus manager when restoring focus.";
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // not NULL, else our delegate. 463 // not NULL, else our delegate.
464 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget, 464 gboolean TabContentsViewGtk::OnMouseMove(GtkWidget* widget,
465 GdkEventMotion* event) { 465 GdkEventMotion* event) {
466 if (sad_tab_ != NULL) 466 if (sad_tab_ != NULL)
467 WidgetGtk::OnMotionNotify(widget, event); 467 WidgetGtk::OnMotionNotify(widget, event);
468 else if (tab_contents()->delegate()) 468 else if (tab_contents()->delegate())
469 tab_contents()->delegate()->ContentsMouseEvent( 469 tab_contents()->delegate()->ContentsMouseEvent(
470 tab_contents(), views::Screen::GetCursorScreenPoint(), true); 470 tab_contents(), views::Screen::GetCursorScreenPoint(), true);
471 return FALSE; 471 return FALSE;
472 } 472 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/page_info_bubble_view.cc ('k') | chrome/browser/ui/views/tab_contents/tab_contents_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698