| 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/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
| 6 | 6 |
| 7 #if defined(OS_LINUX) | 7 #if defined(OS_LINUX) |
| 8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ContentSettingBubbleContents* parent, | 48 ContentSettingBubbleContents* parent, |
| 49 views::Link* link); | 49 views::Link* link); |
| 50 virtual ~Favicon(); | 50 virtual ~Favicon(); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 54 static HCURSOR g_hand_cursor; | 54 static HCURSOR g_hand_cursor; |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 // views::View overrides: | 57 // views::View overrides: |
| 58 virtual bool OnMousePressed(const views::MouseEvent& event); | 58 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
| 59 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 59 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
| 60 virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, | 60 virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, |
| 61 const gfx::Point& p); | 61 const gfx::Point& p) OVERRIDE; |
| 62 | 62 |
| 63 ContentSettingBubbleContents* parent_; | 63 ContentSettingBubbleContents* parent_; |
| 64 views::Link* link_; | 64 views::Link* link_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
| 68 HCURSOR ContentSettingBubbleContents::Favicon::g_hand_cursor = NULL; | 68 HCURSOR ContentSettingBubbleContents::Favicon::g_hand_cursor = NULL; |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 ContentSettingBubbleContents::Favicon::Favicon( | 71 ContentSettingBubbleContents::Favicon::Favicon( |
| 72 const SkBitmap& image, | 72 const SkBitmap& image, |
| 73 ContentSettingBubbleContents* parent, | 73 ContentSettingBubbleContents* parent, |
| 74 views::Link* link) | 74 views::Link* link) |
| 75 : parent_(parent), | 75 : parent_(parent), |
| 76 link_(link) { | 76 link_(link) { |
| 77 SetImage(image); | 77 SetImage(image); |
| 78 } | 78 } |
| 79 | 79 |
| 80 ContentSettingBubbleContents::Favicon::~Favicon() { | 80 ContentSettingBubbleContents::Favicon::~Favicon() { |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool ContentSettingBubbleContents::Favicon::OnMousePressed( | 83 bool ContentSettingBubbleContents::Favicon::OnMousePressed( |
| 84 const views::MouseEvent& event) { | 84 const views::MouseEvent& event) { |
| 85 return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); | 85 return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void ContentSettingBubbleContents::Favicon::OnMouseReleased( | 88 void ContentSettingBubbleContents::Favicon::OnMouseReleased( |
| 89 const views::MouseEvent& event, | 89 const views::MouseEvent& event) { |
| 90 bool canceled) { | 90 if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && |
| 91 if (!canceled && | 91 HitTest(event.location())) { |
| 92 (event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && | |
| 93 HitTest(event.location())) | |
| 94 parent_->LinkActivated(link_, event.flags()); | 92 parent_->LinkActivated(link_, event.flags()); |
| 93 } |
| 95 } | 94 } |
| 96 | 95 |
| 97 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint( | 96 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint( |
| 98 ui::EventType event_type, | 97 ui::EventType event_type, |
| 99 const gfx::Point& p) { | 98 const gfx::Point& p) { |
| 100 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
| 101 if (!g_hand_cursor) | 100 if (!g_hand_cursor) |
| 102 g_hand_cursor = LoadCursor(NULL, IDC_HAND); | 101 g_hand_cursor = LoadCursor(NULL, IDC_HAND); |
| 103 return g_hand_cursor; | 102 return g_hand_cursor; |
| 104 #elif defined(OS_LINUX) | 103 #elif defined(OS_LINUX) |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 layout->StartRow(0, double_column_set_id); | 334 layout->StartRow(0, double_column_set_id); |
| 336 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); | 335 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); |
| 337 manage_link_->SetController(this); | 336 manage_link_->SetController(this); |
| 338 layout->AddView(manage_link_); | 337 layout->AddView(manage_link_); |
| 339 | 338 |
| 340 close_button_ = | 339 close_button_ = |
| 341 new views::NativeButton(this, | 340 new views::NativeButton(this, |
| 342 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); | 341 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); |
| 343 layout->AddView(close_button_); | 342 layout->AddView(close_button_); |
| 344 } | 343 } |
| OLD | NEW |