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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 45 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
46 #include "ui/views/layout/box_layout.h" | 46 #include "ui/views/layout/box_layout.h" |
47 #include "ui/views/layout/grid_layout.h" | 47 #include "ui/views/layout/grid_layout.h" |
48 #include "ui/views/layout/layout_manager.h" | 48 #include "ui/views/layout/layout_manager.h" |
49 #include "ui/views/view.h" | 49 #include "ui/views/view.h" |
50 #include "ui/views/widget/widget.h" | 50 #include "ui/views/widget/widget.h" |
51 #include "url/gurl.h" | 51 #include "url/gurl.h" |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 bool is_popup_showing = false; | |
Peter Kasting
2014/03/18 01:23:13
Using a process-wide variable for this makes me ne
Justin Donnelly
2014/03/18 15:54:48
This works because the omnibox in window A loses f
| |
56 | |
55 // Padding values for sections on the connection tab. | 57 // Padding values for sections on the connection tab. |
56 const int kConnectionSectionPaddingBottom = 16; | 58 const int kConnectionSectionPaddingBottom = 16; |
57 const int kConnectionSectionPaddingLeft = 18; | 59 const int kConnectionSectionPaddingLeft = 18; |
58 const int kConnectionSectionPaddingTop = 16; | 60 const int kConnectionSectionPaddingTop = 16; |
59 const int kConnectionSectionPaddingRight = 18; | 61 const int kConnectionSectionPaddingRight = 18; |
60 | 62 |
61 // The text color that is used for the site identity status text, if the site's | 63 // The text color that is used for the site identity status text, if the site's |
62 // identity was sucessfully verified. | 64 // identity was sucessfully verified. |
63 const int kIdentityVerifiedTextColor = 0xFF298a27; | 65 const int kIdentityVerifiedTextColor = 0xFF298a27; |
64 | 66 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 }; | 135 }; |
134 | 136 |
135 // Website Settings are not supported for internal Chrome pages. Instead of the | 137 // Website Settings are not supported for internal Chrome pages. Instead of the |
136 // |WebsiteSettingsPopupView|, the |InternalPageInfoPopupView| is | 138 // |WebsiteSettingsPopupView|, the |InternalPageInfoPopupView| is |
137 // displayed. | 139 // displayed. |
138 class InternalPageInfoPopupView : public views::BubbleDelegateView { | 140 class InternalPageInfoPopupView : public views::BubbleDelegateView { |
139 public: | 141 public: |
140 explicit InternalPageInfoPopupView(views::View* anchor_view); | 142 explicit InternalPageInfoPopupView(views::View* anchor_view); |
141 virtual ~InternalPageInfoPopupView(); | 143 virtual ~InternalPageInfoPopupView(); |
142 | 144 |
145 // views::BubbleDelegateView: | |
146 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | |
147 | |
143 private: | 148 private: |
144 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); | 149 DISALLOW_COPY_AND_ASSIGN(InternalPageInfoPopupView); |
145 }; | 150 }; |
146 | 151 |
147 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
148 // Popup Header | 153 // Popup Header |
149 //////////////////////////////////////////////////////////////////////////////// | 154 //////////////////////////////////////////////////////////////////////////////// |
150 | 155 |
151 PopupHeaderView::PopupHeaderView(views::ButtonListener* close_button_listener) | 156 PopupHeaderView::PopupHeaderView(views::ButtonListener* close_button_listener) |
152 : name_(NULL), status_(NULL) { | 157 : name_(NULL), status_(NULL) { |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 246 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
242 AddChildView(label); | 247 AddChildView(label); |
243 | 248 |
244 views::BubbleDelegateView::CreateBubble(this)->Show(); | 249 views::BubbleDelegateView::CreateBubble(this)->Show(); |
245 SizeToContents(); | 250 SizeToContents(); |
246 } | 251 } |
247 | 252 |
248 InternalPageInfoPopupView::~InternalPageInfoPopupView() { | 253 InternalPageInfoPopupView::~InternalPageInfoPopupView() { |
249 } | 254 } |
250 | 255 |
256 void InternalPageInfoPopupView::OnWidgetDestroying(views::Widget* widget) { | |
257 is_popup_showing = false; | |
258 } | |
259 | |
251 //////////////////////////////////////////////////////////////////////////////// | 260 //////////////////////////////////////////////////////////////////////////////// |
252 // WebsiteSettingsPopupView | 261 // WebsiteSettingsPopupView |
253 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
254 | 263 |
255 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { | 264 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { |
256 } | 265 } |
257 | 266 |
258 // static | 267 // static |
259 void WebsiteSettingsPopupView::ShowPopup(views::View* anchor_view, | 268 void WebsiteSettingsPopupView::ShowPopup(views::View* anchor_view, |
260 Profile* profile, | 269 Profile* profile, |
261 content::WebContents* web_contents, | 270 content::WebContents* web_contents, |
262 const GURL& url, | 271 const GURL& url, |
263 const content::SSLStatus& ssl, | 272 const content::SSLStatus& ssl, |
264 Browser* browser) { | 273 Browser* browser) { |
274 is_popup_showing = true; | |
265 if (InternalChromePage(url)) { | 275 if (InternalChromePage(url)) { |
266 new InternalPageInfoPopupView(anchor_view); | 276 new InternalPageInfoPopupView(anchor_view); |
267 } else { | 277 } else { |
268 new WebsiteSettingsPopupView(anchor_view, profile, web_contents, url, ssl, | 278 new WebsiteSettingsPopupView(anchor_view, profile, web_contents, url, ssl, |
269 browser); | 279 browser); |
270 } | 280 } |
271 } | 281 } |
272 | 282 |
283 // static | |
284 bool WebsiteSettingsPopupView::IsPopupShowing() { | |
285 return is_popup_showing; | |
286 } | |
287 | |
273 WebsiteSettingsPopupView::WebsiteSettingsPopupView( | 288 WebsiteSettingsPopupView::WebsiteSettingsPopupView( |
274 views::View* anchor_view, | 289 views::View* anchor_view, |
275 Profile* profile, | 290 Profile* profile, |
276 content::WebContents* web_contents, | 291 content::WebContents* web_contents, |
277 const GURL& url, | 292 const GURL& url, |
278 const content::SSLStatus& ssl, | 293 const content::SSLStatus& ssl, |
279 Browser* browser) | 294 Browser* browser) |
280 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), | 295 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
281 web_contents_(web_contents), | 296 web_contents_(web_contents), |
282 browser_(browser), | 297 browser_(browser), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 } | 363 } |
349 | 364 |
350 void WebsiteSettingsPopupView::OnPermissionChanged( | 365 void WebsiteSettingsPopupView::OnPermissionChanged( |
351 PermissionSelectorView* permission_selector) { | 366 PermissionSelectorView* permission_selector) { |
352 DCHECK(permission_selector); | 367 DCHECK(permission_selector); |
353 presenter_->OnSitePermissionChanged(permission_selector->type(), | 368 presenter_->OnSitePermissionChanged(permission_selector->type(), |
354 permission_selector->current_setting()); | 369 permission_selector->current_setting()); |
355 } | 370 } |
356 | 371 |
357 void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) { | 372 void WebsiteSettingsPopupView::OnWidgetDestroying(views::Widget* widget) { |
373 is_popup_showing = false; | |
358 presenter_->OnUIClosing(); | 374 presenter_->OnUIClosing(); |
359 } | 375 } |
360 | 376 |
361 void WebsiteSettingsPopupView::ButtonPressed( | 377 void WebsiteSettingsPopupView::ButtonPressed( |
362 views::Button* button, | 378 views::Button* button, |
363 const ui::Event& event) { | 379 const ui::Event& event) { |
364 GetWidget()->Close(); | 380 GetWidget()->Close(); |
365 } | 381 } |
366 | 382 |
367 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, | 383 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
783 web_contents_, signed_certificate_timestamp_ids_); | 799 web_contents_, signed_certificate_timestamp_ids_); |
784 } else if (source == help_center_link_) { | 800 } else if (source == help_center_link_) { |
785 browser_->OpenURL(content::OpenURLParams( | 801 browser_->OpenURL(content::OpenURLParams( |
786 GURL(chrome::kPageInfoHelpCenterURL), | 802 GURL(chrome::kPageInfoHelpCenterURL), |
787 content::Referrer(), | 803 content::Referrer(), |
788 NEW_FOREGROUND_TAB, | 804 NEW_FOREGROUND_TAB, |
789 content::PAGE_TRANSITION_LINK, | 805 content::PAGE_TRANSITION_LINK, |
790 false)); | 806 false)); |
791 } | 807 } |
792 } | 808 } |
OLD | NEW |