Closed Bug 469739 Opened 16 years ago Closed 16 years ago

Add support for displaying Vista UAC shield icon

Categories

(Core :: Graphics: ImageLib, enhancement)

x86
Windows Vista
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: rain1, Assigned: rain1)

References

Details

(Keywords: fixed1.9.1)

Attachments

(2 files, 1 obsolete file)

Attached patch proposed patch, v1 (obsolete) — Splinter Review
According to the Windows Vista UX guidelines [1], at every UAC entry point one is supposed to display a UAC shield icon. Currently, Mozilla products don't follow this guideline as there isn't support in libpr0n to display such an icon.

This patch adds support to display UAC icons using a standard moz-icon URL. The URL is moz-icon://stock/uac-shield.

Since the Windows version of nsIconChannel didn't have any support for displaying stock icons, I've added generic support for it, and decoupled the file:// specific and the generic hIcon code. More parameters can easily be added as needed.

Most of the patch will require the Vista SDK, as SHGetStockIconInfo and SHSTOCKICONID are both new to Vista. People who don't compile using the Vista SDK shouldn't see a difference.

Stuart: are you an appropriate person to ask for review here? Is the parameter name fine? I also have no idea where this would be documented.

[1] http://msdn.microsoft.com/en-us/library/aa511445.aspx#guidelines
Attachment #353120 - Flags: review?(pavlov)
Comment on attachment 353120 [details] [diff] [review]
proposed patch, v1

Changing r/sr? per stuart.
Attachment #353120 - Flags: superreview?(pavlov)
Attachment #353120 - Flags: review?(pavlov)
Attachment #353120 - Flags: review?(joe)
This is how a button looks with the shield icon.
Oops, missed the FreeLibrary. Also fixed a couple of style issues.
Attachment #353120 - Attachment is obsolete: true
Attachment #353207 - Flags: superreview?(pavlov)
Attachment #353207 - Flags: review?(joe)
Attachment #353120 - Flags: superreview?(pavlov)
Attachment #353120 - Flags: review?(joe)
Comment on attachment 353207 [details] [diff] [review]
proposed patch, v1.01, added FreeLibrary
[Checkin: Comment 7]

>+  nsCAutoString stockIcon;
>+  iconURI->GetStockIcon(stockIcon);
>+  if (!stockIcon.IsEmpty())
>+    rv = GetStockHIcon(iconURI, &hIcon);
>+  else
>+#endif
>+    rv = GetHIconFromFile(&hIcon);

Is there any possibility that GetHIconFromFile will return a result when GetStockHIcon can't? If so, I'd rather this fall back rather than being an else condition. 

>+#include <windows.h>

I am 80% sure that including windows.h in a Mozilla .h file is frowned upon, but am willing to be shown to be wrong.

r+ as long as windows.h in a Mozilla header is okay; r- otherwise.
Attachment #353207 - Flags: superreview?(vladimir)
Attachment #353207 - Flags: superreview?(pavlov)
Attachment #353207 - Flags: review?(joe)
Attachment #353207 - Flags: review+
Thanks for reviewing!

(In reply to comment #4)
> Is there any possibility that GetHIconFromFile will return a result when
> GetStockHIcon can't? If so, I'd rather this fall back rather than being an else
> condition.

No, I don't think so. According to the moz-icon "spec" <http://mxr.mozilla.org/mozilla-central/source/modules/libpr0n/decoders/icon/nsIIconURI.idl>, a url can be one of the two, not both.

> 
> >+#include <windows.h>
> 
> I am 80% sure that including windows.h in a Mozilla .h file is frowned upon,
> but am willing to be shown to be wrong.
> 
> r+ as long as windows.h in a Mozilla header is okay; r- otherwise.

FWIW: <http://mxr.mozilla.org/mozilla-central/search?string=%3Cwindows.h%3E&find=.*\.h&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central>
Attachment #353207 - Flags: superreview?(vladimir) → superreview+
Keywords: checkin-needed
Joe clarified that the patch was r+ him, as the header file touched in the patch is Windows only.
Comment on attachment 353207 [details] [diff] [review]
proposed patch, v1.01, added FreeLibrary
[Checkin: Comment 7]

http://hg.mozilla.org/mozilla-central/rev/1a6d5321e253
Attachment #353207 - Attachment description: proposed patch, v1.01, added FreeLibrary → proposed patch, v1.01, added FreeLibrary [Checkin: Comment 7]
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Comment on attachment 353207 [details] [diff] [review]
proposed patch, v1.01, added FreeLibrary
[Checkin: Comment 7]

Pretty low risk, no effect on existing code, and this + adding the shield to the updater button will be a nice visual integration win.
Attachment #353207 - Flags: approval1.9.1?
Blocks: 470733
Attachment #353207 - Flags: approval1.9.1? → approval1.9.1+
Comment on attachment 353207 [details] [diff] [review]
proposed patch, v1.01, added FreeLibrary
[Checkin: Comment 7]

a191=beltzner
Keywords: checkin-needed
Whiteboard: [checkin-needed to 1.9.1]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: