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

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

Issue 6507028: Remove usages of RootView from View by moving relevant RootView API methods t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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/views/tab_contents/native_tab_contents_container_gtk .h" 5 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container_gtk .h"
6 6
7 #include "chrome/browser/renderer_host/render_widget_host_view.h" 7 #include "chrome/browser/renderer_host/render_widget_host_view.h"
8 #include "chrome/browser/tab_contents/interstitial_page.h" 8 #include "chrome/browser/tab_contents/interstitial_page.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 9 #include "chrome/browser/tab_contents/tab_contents.h"
10 #include "chrome/browser/ui/view_ids.h" 10 #include "chrome/browser/ui/view_ids.h"
11 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 11 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
12 #include "views/focus/focus_manager.h" 12 #include "views/focus/focus_manager.h"
13 #include "views/widget/root_view.h"
14 #include "views/widget/widget.h"
15 13
16 //////////////////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////////////////
17 // NativeTabContentsContainerGtk, public: 15 // NativeTabContentsContainerGtk, public:
18 16
19 NativeTabContentsContainerGtk::NativeTabContentsContainerGtk( 17 NativeTabContentsContainerGtk::NativeTabContentsContainerGtk(
20 TabContentsContainer* container) 18 TabContentsContainer* container)
21 : container_(container), 19 : container_(container),
22 focus_callback_id_(0) { 20 focus_callback_id_(0) {
23 SetID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 21 SetID(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
24 } 22 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 103
106 void NativeTabContentsContainerGtk::RequestFocus() { 104 void NativeTabContentsContainerGtk::RequestFocus() {
107 // This is a hack to circumvent the fact that a view does not explicitly get 105 // This is a hack to circumvent the fact that a view does not explicitly get
108 // a call to set the focus if it already has the focus. This causes a problem 106 // a call to set the focus if it already has the focus. This causes a problem
109 // with tabs such as the TabContents that instruct the RenderView that it got 107 // with tabs such as the TabContents that instruct the RenderView that it got
110 // focus when they actually get the focus. When switching from one TabContents 108 // focus when they actually get the focus. When switching from one TabContents
111 // tab that has focus to another TabContents tab that had focus, since the 109 // tab that has focus to another TabContents tab that had focus, since the
112 // TabContentsContainerView already has focus, Focus() would not be called and 110 // TabContentsContainerView already has focus, Focus() would not be called and
113 // the RenderView would not get notified it got focused. 111 // the RenderView would not get notified it got focused.
114 // By clearing the focused view before-hand, we ensure Focus() will be called. 112 // By clearing the focused view before-hand, we ensure Focus() will be called.
115 GetRootView()->FocusView(NULL); 113 views::FocusManager* focus_manager = GetFocusManager();
114 if (focus_manager)
115 focus_manager->SetFocusedView(NULL);
116 View::RequestFocus(); 116 View::RequestFocus();
117 } 117 }
118 118
119 void NativeTabContentsContainerGtk::AboutToRequestFocusFromTabTraversal( 119 void NativeTabContentsContainerGtk::AboutToRequestFocusFromTabTraversal(
120 bool reverse) { 120 bool reverse) {
121 if (!container_->tab_contents()) 121 if (!container_->tab_contents())
122 return; 122 return;
123 // Give an opportunity to the tab to reset its focus. 123 // Give an opportunity to the tab to reset its focus.
124 if (container_->tab_contents()->interstitial_page()) { 124 if (container_->tab_contents()->interstitial_page()) {
125 container_->tab_contents()->interstitial_page()->FocusThroughTabTraversal( 125 container_->tab_contents()->interstitial_page()->FocusThroughTabTraversal(
126 reverse); 126 reverse);
127 return; 127 return;
128 } 128 }
129 container_->tab_contents()->FocusThroughTabTraversal(reverse); 129 container_->tab_contents()->FocusThroughTabTraversal(reverse);
130 } 130 }
131 131
132 AccessibilityTypes::Role NativeTabContentsContainerGtk::GetAccessibleRole() { 132 AccessibilityTypes::Role NativeTabContentsContainerGtk::GetAccessibleRole() {
133 return AccessibilityTypes::ROLE_GROUPING; 133 return AccessibilityTypes::ROLE_GROUPING;
134 } 134 }
135 135
136 //////////////////////////////////////////////////////////////////////////////// 136 ////////////////////////////////////////////////////////////////////////////////
137 // NativeTabContentsContainer, public: 137 // NativeTabContentsContainer, public:
138 138
139 // static 139 // static
140 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer( 140 NativeTabContentsContainer* NativeTabContentsContainer::CreateNativeContainer(
141 TabContentsContainer* container) { 141 TabContentsContainer* container) {
142 return new NativeTabContentsContainerGtk(container); 142 return new NativeTabContentsContainerGtk(container);
143 } 143 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/tabs/dragged_tab_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698