OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/find_bar_host.h" | 5 #include "chrome/browser/views/find_bar_host.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "chrome/browser/find_bar_controller.h" | 9 #include "chrome/browser/find_bar_controller.h" |
10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
12 #include "chrome/browser/views/frame/browser_view.h" | 12 #include "chrome/browser/views/frame/browser_view.h" |
| 13 #include "chrome/browser/views/tab_contents/tab_contents_view_gtk.h" |
13 #include "views/widget/widget_gtk.h" | 14 #include "views/widget/widget_gtk.h" |
14 | 15 |
15 void FindBarHost::UpdateWindowEdges(const gfx::Rect& new_pos) { | |
16 // TODO(davemoore) move the windows implementation to CustomFrameWindow so we | |
17 // don't have to implement it for gtk | |
18 NOTIMPLEMENTED(); | |
19 } | |
20 | |
21 void FindBarHost::AudibleAlert() { | 16 void FindBarHost::AudibleAlert() { |
22 // TODO(davemoore) implement | 17 // TODO(davemoore) implement |
23 NOTIMPLEMENTED(); | 18 NOTIMPLEMENTED(); |
24 } | 19 } |
25 | 20 |
26 views::Widget* FindBarHost::CreateHost() { | 21 views::Widget* FindBarHost::CreateHost() { |
27 views::WidgetGtk* host = new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); | 22 views::WidgetGtk* host = new views::WidgetGtk(views::WidgetGtk::TYPE_CHILD); |
28 // We own the host. | 23 // We own the host. |
29 host->set_delete_on_destroy(false); | 24 host->set_delete_on_destroy(false); |
30 return host; | 25 return host; |
31 } | 26 } |
32 | 27 |
33 void FindBarHost::SetDialogPositionNative(const gfx::Rect& new_pos, | 28 void FindBarHost::SetDialogPositionNative(const gfx::Rect& new_pos, |
34 bool no_redraw) { | 29 bool no_redraw) { |
35 host_->SetBounds(new_pos); | 30 host_->SetBounds(new_pos); |
36 host_->Show(); | 31 host_->Show(); |
37 } | 32 } |
38 | 33 |
39 void FindBarHost::GetDialogPositionNative(gfx::Rect* avoid_overlapping_rect) { | 34 void FindBarHost::GetDialogPositionNative(gfx::Rect* avoid_overlapping_rect) { |
40 // TODO(davemoore) implement | 35 gfx::Rect frame_rect, webcontents_rect; |
41 NOTIMPLEMENTED(); | 36 host_->GetRootWidget()->GetBounds(&frame_rect, true); |
| 37 TabContentsView* tab_view = find_bar_controller_->tab_contents()->view(); |
| 38 static_cast<TabContentsViewGtk*>(tab_view)->GetBounds(&webcontents_rect, |
| 39 true); |
| 40 avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y()); |
42 } | 41 } |
43 | 42 |
44 | 43 |
45 gfx::NativeView FindBarHost::GetNativeView(BrowserView* browser_view) { | 44 gfx::NativeView FindBarHost::GetNativeView(BrowserView* browser_view) { |
46 return static_cast<views::WidgetGtk*>( | 45 return static_cast<views::WidgetGtk*>( |
47 browser_view->GetWidget())->window_contents(); | 46 browser_view->GetWidget())->window_contents(); |
48 } | 47 } |
49 | 48 |
50 | 49 |
51 NativeWebKeyboardEvent FindBarHost::GetKeyboardEvent( | 50 NativeWebKeyboardEvent FindBarHost::GetKeyboardEvent( |
52 const TabContents* contents, | 51 const TabContents* contents, |
53 const views::Textfield::Keystroke& key_stroke) { | 52 const views::Textfield::Keystroke& key_stroke) { |
54 return NativeWebKeyboardEvent(key_stroke.event()); | 53 return NativeWebKeyboardEvent(key_stroke.event()); |
55 } | 54 } |
56 | 55 |
57 bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( | 56 bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( |
58 const views::Textfield::Keystroke& key_stroke) { | 57 const views::Textfield::Keystroke& key_stroke) { |
59 return true; | 58 return true; |
60 } | 59 } |
OLD | NEW |