Chromium Code Reviews| 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/website_settings/website_settings_popup_view.h " | 5 #include "chrome/browser/ui/views/website_settings/website_settings_popup_view.h " |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 const int kHeaderMarginBottom = 10; | 77 const int kHeaderMarginBottom = 10; |
| 78 const int kHeaderPaddingBottom = 12; | 78 const int kHeaderPaddingBottom = 12; |
| 79 const int kHeaderPaddingLeft = 18; | 79 const int kHeaderPaddingLeft = 18; |
| 80 const int kHeaderPaddingRight = 8; | 80 const int kHeaderPaddingRight = 8; |
| 81 const int kHeaderPaddingTop = 12; | 81 const int kHeaderPaddingTop = 12; |
| 82 | 82 |
| 83 // Spacing between the site identity label and the site identity status text in | 83 // Spacing between the site identity label and the site identity status text in |
| 84 // the popup header. | 84 // the popup header. |
| 85 const int kHeaderRowSpacing = 4; | 85 const int kHeaderRowSpacing = 4; |
| 86 | 86 |
| 87 // To make the bubble's arrow point directly at the location icon rather than at | |
| 88 // the Omnibox's edge, inset the bubble's anchor rect by this amount of pixels. | |
| 89 const int kLocationIconVerticalMargin = 5; | |
| 90 | |
| 91 // The max possible width of the popup. | 87 // The max possible width of the popup. |
| 92 const int kMaxPopupWidth = 500; | 88 const int kMaxPopupWidth = 500; |
| 93 | 89 |
| 94 // The margins between the popup border and the popup content. | 90 // The margins between the popup border and the popup content. |
| 95 const int kPopupMarginTop = 4; | 91 const int kPopupMarginTop = 4; |
| 96 const int kPopupMarginLeft = 0; | 92 const int kPopupMarginLeft = 0; |
| 97 const int kPopupMarginBottom = 10; | 93 const int kPopupMarginBottom = 10; |
| 98 const int kPopupMarginRight = 0; | 94 const int kPopupMarginRight = 0; |
| 99 | 95 |
| 100 // Padding values for sections on the permissions tab. | 96 // Padding values for sections on the permissions tab. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 status_->SetEnabledColor(text_color); | 225 status_->SetEnabledColor(text_color); |
| 230 } | 226 } |
| 231 | 227 |
| 232 //////////////////////////////////////////////////////////////////////////////// | 228 //////////////////////////////////////////////////////////////////////////////// |
| 233 // InternalPageInfoPopupView | 229 // InternalPageInfoPopupView |
| 234 //////////////////////////////////////////////////////////////////////////////// | 230 //////////////////////////////////////////////////////////////////////////////// |
| 235 | 231 |
| 236 InternalPageInfoPopupView::InternalPageInfoPopupView(views::View* anchor_view) | 232 InternalPageInfoPopupView::InternalPageInfoPopupView(views::View* anchor_view) |
| 237 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) { | 233 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT) { |
| 238 // Compensate for built-in vertical padding in the anchor view's image. | 234 // Compensate for built-in vertical padding in the anchor view's image. |
| 239 set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0, | 235 set_anchor_view_insets( |
| 240 kLocationIconVerticalMargin, 0)); | 236 gfx::Insets(WebsiteSettingsPopupView::kLocationIconVerticalMargin, 0, |
| 237 WebsiteSettingsPopupView::kLocationIconVerticalMargin, 0)); | |
| 241 | 238 |
| 242 const int kSpacing = 4; | 239 const int kSpacing = 4; |
| 243 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, | 240 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, |
| 244 kSpacing, kSpacing)); | 241 kSpacing, kSpacing)); |
| 245 views::ImageView* icon_view = new views::ImageView(); | 242 views::ImageView* icon_view = new views::ImageView(); |
| 246 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 243 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 247 icon_view->SetImage(rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_26)); | 244 icon_view->SetImage(rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_26)); |
| 248 AddChildView(icon_view); | 245 AddChildView(icon_view); |
| 249 | 246 |
| 250 views::Label* label = | 247 views::Label* label = |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 262 } | 259 } |
| 263 | 260 |
| 264 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { | 261 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { |
| 265 is_popup_showing = false; | 262 is_popup_showing = false; |
| 266 } | 263 } |
| 267 | 264 |
| 268 //////////////////////////////////////////////////////////////////////////////// | 265 //////////////////////////////////////////////////////////////////////////////// |
| 269 // WebsiteSettingsPopupView | 266 // WebsiteSettingsPopupView |
| 270 //////////////////////////////////////////////////////////////////////////////// | 267 //////////////////////////////////////////////////////////////////////////////// |
| 271 | 268 |
| 269 const int WebsiteSettingsPopupView::kLocationIconVerticalMargin = 5; | |
| 270 | |
| 272 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { | 271 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { |
| 273 } | 272 } |
| 274 | 273 |
| 275 // static | 274 // static |
| 276 void WebsiteSettingsPopupView::ShowPopup(views::View* anchor_view, | 275 views::BubbleDelegateView* WebsiteSettingsPopupView::ShowPopup( |
| 277 Profile* profile, | 276 views::View* anchor_view, |
| 278 content::WebContents* web_contents, | 277 Profile* profile, |
| 279 const GURL& url, | 278 content::WebContents* web_contents, |
| 280 const content::SSLStatus& ssl) { | 279 const GURL& url, |
| 280 const content::SSLStatus& ssl) { | |
| 281 is_popup_showing = true; | 281 is_popup_showing = true; |
| 282 if (InternalChromePage(url)) { | 282 if (InternalChromePage(url)) { |
| 283 new InternalPageInfoPopupView(anchor_view); | 283 return new InternalPageInfoPopupView(anchor_view); |
| 284 } else { | 284 } else { |
|
msw
2015/08/11 22:09:11
nit: no else after return
jackhou1
2015/08/17 04:54:19
Done.
| |
| 285 new WebsiteSettingsPopupView(anchor_view, profile, web_contents, url, ssl); | 285 return new WebsiteSettingsPopupView(anchor_view, profile, web_contents, url, |
| 286 ssl); | |
| 286 } | 287 } |
| 287 } | 288 } |
| 288 | 289 |
| 289 // static | 290 // static |
| 290 bool WebsiteSettingsPopupView::IsPopupShowing() { | 291 bool WebsiteSettingsPopupView::IsPopupShowing() { |
| 291 return is_popup_showing; | 292 return is_popup_showing; |
| 292 } | 293 } |
| 293 | 294 |
| 294 WebsiteSettingsPopupView::WebsiteSettingsPopupView( | 295 WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
| 295 views::View* anchor_view, | 296 views::View* anchor_view, |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 813 // desktop we should link to that here, too. | 814 // desktop we should link to that here, too. |
| 814 web_contents_->OpenURL(content::OpenURLParams( | 815 web_contents_->OpenURL(content::OpenURLParams( |
| 815 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), | 816 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), |
| 816 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); | 817 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); |
| 817 presenter_->RecordWebsiteSettingsAction( | 818 presenter_->RecordWebsiteSettingsAction( |
| 818 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); | 819 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); |
| 819 } else { | 820 } else { |
| 820 NOTREACHED(); | 821 NOTREACHED(); |
| 821 } | 822 } |
| 822 } | 823 } |
| OLD | NEW |