OLD | NEW |
---|---|
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/compact_nav/compact_location_bar_view_host.h" | 5 #include "chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 bool observing_; | 83 bool observing_; |
84 | 84 |
85 DISALLOW_COPY_AND_ASSIGN(MouseObserver); | 85 DISALLOW_COPY_AND_ASSIGN(MouseObserver); |
86 }; | 86 }; |
87 | 87 |
88 MouseObserver::MouseObserver(CompactLocationBarViewHost* host, | 88 MouseObserver::MouseObserver(CompactLocationBarViewHost* host, |
89 BrowserView* view) | 89 BrowserView* view) |
90 : host_(host), | 90 : host_(host), |
91 browser_view_(view), | 91 browser_view_(view), |
92 observing_(false) { | 92 observing_(false) { |
93 top_level_window_ = browser_view_->GetWidget()->GetNativeView(); | 93 top_level_window_ = browser_view_->GetWidget()->GetNativeView(); |
MAD
2011/05/24 19:14:47
Please add a DCHECK that host_ and browser_view_ a
| |
94 } | 94 } |
95 | 95 |
96 MouseObserver::~MouseObserver() { | 96 MouseObserver::~MouseObserver() { |
97 StopObserving(MessageLoopForUI::current()); | 97 StopObserving(MessageLoopForUI::current()); |
98 } | 98 } |
99 | 99 |
100 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
101 void MouseObserver::WillProcessMessage(const MSG& native_event) {} | 101 void MouseObserver::WillProcessMessage(const MSG& native_event) {} |
102 void MouseObserver::DidProcessMessage(const MSG& native_event) { | 102 void MouseObserver::DidProcessMessage(const MSG& native_event) { |
103 #elif defined(OS_LINUX) | 103 #elif defined(OS_LINUX) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 } | 157 } |
158 | 158 |
159 bool MouseObserver::HitContentArea(int x, int y) { | 159 bool MouseObserver::HitContentArea(int x, int y) { |
160 gfx::Point p(x, y); | 160 gfx::Point p(x, y); |
161 // First, exclude the location bar as it's shown on top of | 161 // First, exclude the location bar as it's shown on top of |
162 // content area. | 162 // content area. |
163 if (HitOnScreen(host_->view(), p)) { | 163 if (HitOnScreen(host_->view(), p)) { |
164 return false; | 164 return false; |
165 } | 165 } |
166 // Treat the bookmark as a content area when it in detached mode. | 166 // Treat the bookmark as a content area when it in detached mode. |
167 if (browser_view_->GetBookmarkBarView()->IsDetached() && | 167 if (browser_view_->GetBookmarkBarView() && |
MAD
2011/05/24 19:14:47
Please add a comment that the bookmark bar view ca
| |
168 browser_view_->GetBookmarkBarView()->IsDetached() && | |
168 browser_view_->IsBookmarkBarVisible() && | 169 browser_view_->IsBookmarkBarVisible() && |
169 HitOnScreen(browser_view_->GetBookmarkBarView(), p)) { | 170 HitOnScreen(browser_view_->GetBookmarkBarView(), p)) { |
170 return true; | 171 return true; |
171 } | 172 } |
172 if (HitOnScreen(browser_view_->GetContentsView(), p)) { | 173 if (HitOnScreen(browser_view_->GetContentsView(), p)) { |
173 return true; | 174 return true; |
174 } | 175 } |
175 return false; | 176 return false; |
176 } | 177 } |
177 | 178 |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
508 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { | 509 bool CompactLocationBarViewHost::IsCurrentTabIndex(int index) { |
509 return current_tab_model_index_ == index; | 510 return current_tab_model_index_ == index; |
510 } | 511 } |
511 | 512 |
512 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { | 513 bool CompactLocationBarViewHost::IsCurrentTab(TabContents* contents) { |
513 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); | 514 TabStripModel* tab_strip_model = browser_view()->browser()->tabstrip_model(); |
514 return tab_strip_model->ContainsIndex(current_tab_model_index_) && | 515 return tab_strip_model->ContainsIndex(current_tab_model_index_) && |
515 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> | 516 tab_strip_model->GetTabContentsAt(current_tab_model_index_)-> |
516 tab_contents() == contents; | 517 tab_contents() == contents; |
517 } | 518 } |
OLD | NEW |