OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 class ContentSettingBubbleContents::Favicon : public views::ImageView { | 46 class ContentSettingBubbleContents::Favicon : public views::ImageView { |
47 public: | 47 public: |
48 Favicon(const SkBitmap& image, | 48 Favicon(const SkBitmap& image, |
49 ContentSettingBubbleContents* parent, | 49 ContentSettingBubbleContents* parent, |
50 views::Link* link); | 50 views::Link* link); |
51 virtual ~Favicon(); | 51 virtual ~Favicon(); |
52 | 52 |
53 private: | 53 private: |
54 // views::View overrides: | 54 // views::View overrides: |
55 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 55 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
56 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 56 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
57 virtual gfx::NativeCursor GetCursor(const views::MouseEvent& event) OVERRIDE; | 57 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE; |
58 | 58 |
59 ContentSettingBubbleContents* parent_; | 59 ContentSettingBubbleContents* parent_; |
60 views::Link* link_; | 60 views::Link* link_; |
61 }; | 61 }; |
62 | 62 |
63 ContentSettingBubbleContents::Favicon::Favicon( | 63 ContentSettingBubbleContents::Favicon::Favicon( |
64 const SkBitmap& image, | 64 const SkBitmap& image, |
65 ContentSettingBubbleContents* parent, | 65 ContentSettingBubbleContents* parent, |
66 views::Link* link) | 66 views::Link* link) |
67 : parent_(parent), | 67 : parent_(parent), |
68 link_(link) { | 68 link_(link) { |
69 SetImage(image); | 69 SetImage(image); |
70 } | 70 } |
71 | 71 |
72 ContentSettingBubbleContents::Favicon::~Favicon() { | 72 ContentSettingBubbleContents::Favicon::~Favicon() { |
73 } | 73 } |
74 | 74 |
75 bool ContentSettingBubbleContents::Favicon::OnMousePressed( | 75 bool ContentSettingBubbleContents::Favicon::OnMousePressed( |
76 const views::MouseEvent& event) { | 76 const ui::MouseEvent& event) { |
77 return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); | 77 return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); |
78 } | 78 } |
79 | 79 |
80 void ContentSettingBubbleContents::Favicon::OnMouseReleased( | 80 void ContentSettingBubbleContents::Favicon::OnMouseReleased( |
81 const views::MouseEvent& event) { | 81 const ui::MouseEvent& event) { |
82 if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && | 82 if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && |
83 HitTestPoint(event.location())) { | 83 HitTestPoint(event.location())) { |
84 parent_->LinkClicked(link_, event.flags()); | 84 parent_->LinkClicked(link_, event.flags()); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursor( | 88 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursor( |
89 const views::MouseEvent& event) { | 89 const ui::MouseEvent& event) { |
90 #if defined(USE_AURA) | 90 #if defined(USE_AURA) |
91 return ui::kCursorHand; | 91 return ui::kCursorHand; |
92 #elif defined(OS_WIN) | 92 #elif defined(OS_WIN) |
93 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); | 93 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND); |
94 return g_hand_cursor; | 94 return g_hand_cursor; |
95 #endif | 95 #endif |
96 } | 96 } |
97 | 97 |
98 ContentSettingBubbleContents::ContentSettingBubbleContents( | 98 ContentSettingBubbleContents::ContentSettingBubbleContents( |
99 ContentSettingBubbleModel* content_setting_bubble_model, | 99 ContentSettingBubbleModel* content_setting_bubble_model, |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 | 325 |
326 void ContentSettingBubbleContents::Observe( | 326 void ContentSettingBubbleContents::Observe( |
327 int type, | 327 int type, |
328 const content::NotificationSource& source, | 328 const content::NotificationSource& source, |
329 const content::NotificationDetails& details) { | 329 const content::NotificationDetails& details) { |
330 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); | 330 DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED); |
331 DCHECK(source == content::Source<WebContents>(web_contents_)); | 331 DCHECK(source == content::Source<WebContents>(web_contents_)); |
332 web_contents_ = NULL; | 332 web_contents_ = NULL; |
333 } | 333 } |
OLD | NEW |