Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1730)

Side by Side Diff: chrome/browser/ui/views/content_setting_bubble_contents.cc

Issue 6880201: Scrap WNDCLASSEX.hCursor, update GetCursorForPoint, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use brace style struct init for WNDCLASSEX |class_ex|, fix comment. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/username_view.cc ('k') | ui/base/win/window_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const int kMinMultiLineContentsWidth = 250; 43 const int kMinMultiLineContentsWidth = 250;
44 44
45 class ContentSettingBubbleContents::Favicon : public views::ImageView { 45 class ContentSettingBubbleContents::Favicon : public views::ImageView {
46 public: 46 public:
47 Favicon(const SkBitmap& image, 47 Favicon(const SkBitmap& image,
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)
54 static HCURSOR g_hand_cursor;
55 #endif
56
57 // views::View overrides: 53 // views::View overrides:
58 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; 54 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE;
59 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; 55 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE;
60 virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type, 56 virtual gfx::NativeCursor GetCursorForPoint(ui::EventType event_type,
61 const gfx::Point& p) OVERRIDE; 57 const gfx::Point& p) OVERRIDE;
62 58
63 ContentSettingBubbleContents* parent_; 59 ContentSettingBubbleContents* parent_;
64 views::Link* link_; 60 views::Link* link_;
65 }; 61 };
66 62
67 #if defined(OS_WIN)
68 HCURSOR ContentSettingBubbleContents::Favicon::g_hand_cursor = NULL;
69 #endif
70
71 ContentSettingBubbleContents::Favicon::Favicon( 63 ContentSettingBubbleContents::Favicon::Favicon(
72 const SkBitmap& image, 64 const SkBitmap& image,
73 ContentSettingBubbleContents* parent, 65 ContentSettingBubbleContents* parent,
74 views::Link* link) 66 views::Link* link)
75 : parent_(parent), 67 : parent_(parent),
76 link_(link) { 68 link_(link) {
77 SetImage(image); 69 SetImage(image);
78 } 70 }
79 71
80 ContentSettingBubbleContents::Favicon::~Favicon() { 72 ContentSettingBubbleContents::Favicon::~Favicon() {
81 } 73 }
82 74
83 bool ContentSettingBubbleContents::Favicon::OnMousePressed( 75 bool ContentSettingBubbleContents::Favicon::OnMousePressed(
84 const views::MouseEvent& event) { 76 const views::MouseEvent& event) {
85 return event.IsLeftMouseButton() || event.IsMiddleMouseButton(); 77 return event.IsLeftMouseButton() || event.IsMiddleMouseButton();
86 } 78 }
87 79
88 void ContentSettingBubbleContents::Favicon::OnMouseReleased( 80 void ContentSettingBubbleContents::Favicon::OnMouseReleased(
89 const views::MouseEvent& event) { 81 const views::MouseEvent& event) {
90 if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) && 82 if ((event.IsLeftMouseButton() || event.IsMiddleMouseButton()) &&
91 HitTest(event.location())) { 83 HitTest(event.location())) {
92 parent_->LinkClicked(link_, event.flags()); 84 parent_->LinkClicked(link_, event.flags());
93 } 85 }
94 } 86 }
95 87
96 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint( 88 gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint(
97 ui::EventType event_type, 89 ui::EventType event_type,
98 const gfx::Point& p) { 90 const gfx::Point& p) {
99 #if defined(OS_WIN) 91 #if defined(OS_WIN)
100 if (!g_hand_cursor) 92 static HCURSOR g_hand_cursor = LoadCursor(NULL, IDC_HAND);
101 g_hand_cursor = LoadCursor(NULL, IDC_HAND);
102 return g_hand_cursor; 93 return g_hand_cursor;
103 #elif defined(OS_LINUX) 94 #elif defined(OS_LINUX)
104 return gfx::GetCursor(GDK_HAND2); 95 return gfx::GetCursor(GDK_HAND2);
105 #endif 96 #endif
106 } 97 }
107 98
108 ContentSettingBubbleContents::ContentSettingBubbleContents( 99 ContentSettingBubbleContents::ContentSettingBubbleContents(
109 ContentSettingBubbleModel* content_setting_bubble_model, 100 ContentSettingBubbleModel* content_setting_bubble_model,
110 Profile* profile, 101 Profile* profile,
111 TabContents* tab_contents) 102 TabContents* tab_contents)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 layout->StartRow(0, double_column_set_id); 325 layout->StartRow(0, double_column_set_id);
335 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link)); 326 manage_link_ = new views::Link(UTF8ToWide(bubble_content.manage_link));
336 manage_link_->set_listener(this); 327 manage_link_->set_listener(this);
337 layout->AddView(manage_link_); 328 layout->AddView(manage_link_);
338 329
339 close_button_ = 330 close_button_ =
340 new views::NativeButton(this, 331 new views::NativeButton(this,
341 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE))); 332 UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
342 layout->AddView(close_button_); 333 layout->AddView(close_button_);
343 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/username_view.cc ('k') | ui/base/win/window_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698