OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/views/find_bar_host.h" |
| 6 |
| 7 #include <gdk/gdkkeysyms.h> |
| 8 |
| 9 #include "chrome/browser/find_bar_controller.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/views/frame/browser_view.h" |
| 13 #include "views/widget/widget_gtk.h" |
| 14 |
| 15 class FindBarHostWidget : public views::WidgetGtk { |
| 16 public: |
| 17 explicit FindBarHostWidget(FindBarHost* find_bar) |
| 18 : WidgetGtk(TYPE_CHILD), |
| 19 find_bar_(find_bar) { |
| 20 // Don't let WidgetGtk manage our lifetime. We want our lifetime to |
| 21 // coincide with TabContents. |
| 22 set_delete_on_destroy(false); |
| 23 } |
| 24 |
| 25 void OnDestroy(GtkWidget* widget) { |
| 26 find_bar_->OnFinalMessage(); |
| 27 } |
| 28 |
| 29 private: |
| 30 FindBarHost* find_bar_; |
| 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(FindBarHostWidget); |
| 33 }; |
| 34 |
| 35 void FindBarHost::UpdateWindowEdges(const gfx::Rect& new_pos) { |
| 36 // TODO(davemoore) move the windows implementation to CustomFrameWindow so we |
| 37 // don't have to implement it for gtk |
| 38 NOTIMPLEMENTED(); |
| 39 } |
| 40 |
| 41 void FindBarHost::AudibleAlert() { |
| 42 // TODO(davemoore) implement |
| 43 NOTIMPLEMENTED(); |
| 44 } |
| 45 |
| 46 views::Widget* FindBarHost::CreateHost() { |
| 47 return new FindBarHostWidget(this); |
| 48 } |
| 49 |
| 50 void FindBarHost::SetDialogPositionNative(const gfx::Rect& new_pos, |
| 51 bool no_redraw) { |
| 52 host_->SetBounds(new_pos); |
| 53 host_->Show(); |
| 54 } |
| 55 |
| 56 void FindBarHost::GetDialogPositionNative(gfx::Rect* avoid_overlapping_rect) { |
| 57 // TODO(davemoore) implement |
| 58 NOTIMPLEMENTED(); |
| 59 } |
| 60 |
| 61 |
| 62 gfx::NativeView FindBarHost::GetNativeView(BrowserView* browser_view) { |
| 63 return static_cast<views::WidgetGtk*>( |
| 64 browser_view->GetWidget())->window_contents(); |
| 65 } |
| 66 |
| 67 |
| 68 NativeWebKeyboardEvent FindBarHost::GetKeyboardEvent( |
| 69 const TabContents* contents, |
| 70 const views::Textfield::Keystroke& key_stroke) { |
| 71 return NativeWebKeyboardEvent(key_stroke.event()); |
| 72 } |
| 73 |
OLD | NEW |