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

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

Issue 8632001: Removed TOUCH_UI (mostly constants) from chrome/browser/ui/views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 1 month 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/tab_contents_container.h" 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h"
6 6
7 #if defined(TOUCH_UI)
8 #include <X11/extensions/XInput2.h>
9 #endif
10
11 #include "chrome/browser/ui/view_ids.h" 7 #include "chrome/browser/ui/view_ids.h"
12 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h" 8 #include "chrome/browser/ui/views/tab_contents/native_tab_contents_container.h"
13 #include "content/browser/renderer_host/render_view_host.h" 9 #include "content/browser/renderer_host/render_view_host.h"
14 #include "content/browser/renderer_host/render_widget_host_view.h" 10 #include "content/browser/renderer_host/render_widget_host_view.h"
15 #include "content/browser/tab_contents/interstitial_page.h" 11 #include "content/browser/tab_contents/interstitial_page.h"
16 #include "content/browser/tab_contents/tab_contents.h" 12 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/public/browser/notification_details.h" 13 #include "content/public/browser/notification_details.h"
18 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
19 15
20 // Some of this class is implemented in tab_contents_container.cc, where 16 // Some of this class is implemented in tab_contents_container.cc, where
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 //////////////////////////////////////////////////////////////////////////////// 62 ////////////////////////////////////////////////////////////////////////////////
67 // TabContentsContainer, View overrides: 63 // TabContentsContainer, View overrides:
68 64
69 void TabContentsContainer::Layout() { 65 void TabContentsContainer::Layout() {
70 if (native_container_) { 66 if (native_container_) {
71 native_container_->GetView()->SetBounds(0, 0, width(), height()); 67 native_container_->GetView()->SetBounds(0, 0, width(), height());
72 native_container_->GetView()->Layout(); 68 native_container_->GetView()->Layout();
73 } 69 }
74 } 70 }
75 71
76 #if defined(TOUCH_UI)
77 bool TabContentsContainer::OnMousePressed(const views::MouseEvent& event) {
78 DCHECK(tab_contents_);
79 if (event.flags() & (ui::EF_LEFT_BUTTON_DOWN |
80 ui::EF_RIGHT_BUTTON_DOWN |
81 ui::EF_MIDDLE_BUTTON_DOWN)) {
82 return false;
83 }
84 // It is necessary to look at the native event to determine what special
85 // button was pressed.
86 views::NativeEvent native_event = event.native_event();
87 if (!native_event)
88 return false;
89
90 int button = 0;
91 switch (native_event->type) {
92 case ButtonPress: {
93 button = native_event->xbutton.button;
94 break;
95 }
96 case GenericEvent: {
97 XIDeviceEvent* xievent =
98 static_cast<XIDeviceEvent*>(native_event->xcookie.data);
99 button = xievent->detail;
100 break;
101 }
102 default:
103 break;
104 }
105 switch (button) {
106 case 8:
107 tab_contents_->controller().GoBack();
108 return true;
109 case 9:
110 tab_contents_->controller().GoForward();
111 return true;
112 }
113
114 return false;
115 }
116 #endif
117
118 void TabContentsContainer::ViewHierarchyChanged(bool is_add, 72 void TabContentsContainer::ViewHierarchyChanged(bool is_add,
119 views::View* parent, 73 views::View* parent,
120 views::View* child) { 74 views::View* child) {
121 if (is_add && child == this) { 75 if (is_add && child == this) {
122 native_container_ = NativeTabContentsContainer::CreateNativeContainer(this); 76 native_container_ = NativeTabContentsContainer::CreateNativeContainer(this);
123 AddChildView(native_container_->GetView()); 77 AddChildView(native_container_->GetView());
124 } 78 }
125 } 79 }
126 80
127 //////////////////////////////////////////////////////////////////////////////// 81 ////////////////////////////////////////////////////////////////////////////////
128 // TabContentsContainer, private: 82 // TabContentsContainer, private:
129 83
130 void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host, 84 void TabContentsContainer::RenderViewHostChanged(RenderViewHost* old_host,
131 RenderViewHost* new_host) { 85 RenderViewHost* new_host) {
132 if (new_host) 86 if (new_host)
133 RenderWidgetHostViewChanged(new_host->view()); 87 RenderWidgetHostViewChanged(new_host->view());
134 native_container_->RenderViewHostChanged(old_host, new_host); 88 native_container_->RenderViewHostChanged(old_host, new_host);
135 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698