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

Side by Side Diff: chrome/browser/toolbar_model.cc

Issue 193026: Merge 25494 - Use system themes where possible in Omnibox edit and dropdown; ... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 3 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
Property Changes:
Added: svn:mergeinfo
Merged /trunk/src/chrome/browser/toolbar_model.cc:r25494
Merged /branches/chrome_webkit_merge_branch/chrome/browser/toolbar_model.cc:r69-2775
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/toolbar_model.h" 5 #include "chrome/browser/toolbar_model.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/cert_store.h" 8 #include "chrome/browser/cert_store.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/ssl/ssl_error_info.h" 10 #include "chrome/browser/ssl/ssl_error_info.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return ToolbarModel::WARNING_ICON; 99 return ToolbarModel::WARNING_ICON;
100 case SECURITY_STYLE_UNKNOWN: 100 case SECURITY_STYLE_UNKNOWN:
101 case SECURITY_STYLE_UNAUTHENTICATED: 101 case SECURITY_STYLE_UNAUTHENTICATED:
102 return ToolbarModel::NO_ICON; 102 return ToolbarModel::NO_ICON;
103 default: 103 default:
104 NOTREACHED(); 104 NOTREACHED();
105 return ToolbarModel::NO_ICON; 105 return ToolbarModel::NO_ICON;
106 } 106 }
107 } 107 }
108 108
109 void ToolbarModel::GetIconHoverText(std::wstring* text, SkColor* text_color) { 109 void ToolbarModel::GetIconHoverText(std::wstring* text) {
110 static const SkColor kOKHttpsInfoBubbleTextColor = 110 DCHECK(text);
111 SkColorSetRGB(0, 153, 51); // Green.
112 static const SkColor kBrokenHttpsInfoBubbleTextColor =
113 SkColorSetRGB(255, 0, 0); // Red.
114
115 DCHECK(text && text_color);
116 111
117 NavigationController* navigation_controller = GetNavigationController(); 112 NavigationController* navigation_controller = GetNavigationController();
118 // We don't expect to be called during initialization, so the controller 113 // We don't expect to be called during initialization, so the controller
119 // should never be NULL. 114 // should never be NULL.
120 DCHECK(navigation_controller); 115 DCHECK(navigation_controller);
121 NavigationEntry* entry = navigation_controller->GetActiveEntry(); 116 NavigationEntry* entry = navigation_controller->GetActiveEntry();
122 DCHECK(entry); 117 DCHECK(entry);
123 118
124 119
125 const NavigationEntry::SSLStatus& ssl = entry->ssl(); 120 const NavigationEntry::SSLStatus& ssl = entry->ssl();
126 switch (ssl.security_style()) { 121 switch (ssl.security_style()) {
127 case SECURITY_STYLE_AUTHENTICATED: { 122 case SECURITY_STYLE_AUTHENTICATED: {
128 if (ssl.has_mixed_content()) { 123 if (ssl.has_mixed_content()) {
129 SSLErrorInfo error_info = 124 SSLErrorInfo error_info =
130 SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS, 125 SSLErrorInfo::CreateError(SSLErrorInfo::MIXED_CONTENTS,
131 NULL, GURL::EmptyGURL()); 126 NULL, GURL::EmptyGURL());
132 text->assign(error_info.short_description()); 127 text->assign(error_info.short_description());
133 *text_color = kBrokenHttpsInfoBubbleTextColor;
134 } else { 128 } else {
135 DCHECK(entry->url().has_host()); 129 DCHECK(entry->url().has_host());
136 text->assign(l10n_util::GetStringF(IDS_SECURE_CONNECTION, 130 text->assign(l10n_util::GetStringF(IDS_SECURE_CONNECTION,
137 UTF8ToWide(entry->url().host()))); 131 UTF8ToWide(entry->url().host())));
138 *text_color = kOKHttpsInfoBubbleTextColor;
139 } 132 }
140 break; 133 break;
141 } 134 }
142 case SECURITY_STYLE_AUTHENTICATION_BROKEN: { 135 case SECURITY_STYLE_AUTHENTICATION_BROKEN: {
143 CreateErrorText(entry, text); 136 CreateErrorText(entry, text);
144 if (text->empty()) { 137 if (text->empty()) {
145 // If the authentication is broken, we should always have at least one 138 // If the authentication is broken, we should always have at least one
146 // error. 139 // error.
147 NOTREACHED(); 140 NOTREACHED();
148 return; 141 return;
149 } 142 }
150 *text_color = kBrokenHttpsInfoBubbleTextColor;
151 break; 143 break;
152 } 144 }
153 default: 145 default:
154 // Don't show the info bubble in any other cases. 146 // Don't show the info bubble in any other cases.
155 text->clear(); 147 text->clear();
156 break; 148 break;
157 } 149 }
158 } 150 }
159 151
160 ToolbarModel::InfoTextType ToolbarModel::GetInfoText(std::wstring* text, 152 ToolbarModel::InfoTextType ToolbarModel::GetInfoText(std::wstring* text,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 // Multiple errors. 202 // Multiple errors.
211 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS)); 203 text->assign(l10n_util::GetString(IDS_SEVERAL_SSL_ERRORS));
212 text->append(L"\n"); 204 text->append(L"\n");
213 for (int i = 0; i < error_count; ++i) { 205 for (int i = 0; i < error_count; ++i) {
214 text->append(errors[i].short_description()); 206 text->append(errors[i].short_description());
215 if (i != error_count - 1) 207 if (i != error_count - 1)
216 text->append(L"\n"); 208 text->append(L"\n");
217 } 209 }
218 } 210 }
219 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698