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 "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/certificate_viewer.h" | 9 #include "chrome/browser/certificate_viewer.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
35 #include "ui/views/controls/link.h" | 35 #include "ui/views/controls/link.h" |
36 #include "ui/views/controls/menu/menu_model_adapter.h" | 36 #include "ui/views/controls/menu/menu_model_adapter.h" |
37 #include "ui/views/controls/menu/menu_runner.h" | 37 #include "ui/views/controls/menu/menu_runner.h" |
38 #include "ui/views/controls/separator.h" | 38 #include "ui/views/controls/separator.h" |
39 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" | 39 #include "ui/views/controls/tabbed_pane/tabbed_pane.h" |
40 #include "ui/views/layout/box_layout.h" | 40 #include "ui/views/layout/box_layout.h" |
41 #include "ui/views/layout/grid_layout.h" | 41 #include "ui/views/layout/grid_layout.h" |
42 #include "ui/views/layout/layout_manager.h" | 42 #include "ui/views/layout/layout_manager.h" |
43 #include "ui/views/view.h" | 43 #include "ui/views/view.h" |
| 44 #include "ui/views/widget/widget.h" |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
47 // Padding values for sections on the connection tab. | 48 // Padding values for sections on the connection tab. |
48 const int kConnectionSectionPaddingBottom = 16; | 49 const int kConnectionSectionPaddingBottom = 16; |
49 const int kConnectionSectionPaddingLeft = 18; | 50 const int kConnectionSectionPaddingLeft = 18; |
50 const int kConnectionSectionPaddingTop = 16; | 51 const int kConnectionSectionPaddingTop = 16; |
51 const int kConnectionSectionPaddingRight = 18; | 52 const int kConnectionSectionPaddingRight = 18; |
52 | 53 |
53 // Font size of the label for the site identity. | 54 // Font size of the label for the site identity. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 tabbed_pane_->set_listener(this); | 316 tabbed_pane_->set_listener(this); |
316 | 317 |
317 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, | 318 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, |
318 kPopupMarginBottom, kPopupMarginRight)); | 319 kPopupMarginBottom, kPopupMarginRight)); |
319 | 320 |
320 views::BubbleDelegateView::CreateBubble(this); | 321 views::BubbleDelegateView::CreateBubble(this); |
321 this->Show(); | 322 this->Show(); |
322 SizeToContents(); | 323 SizeToContents(); |
323 | 324 |
324 presenter_.reset(new WebsiteSettings(this, profile, | 325 presenter_.reset(new WebsiteSettings(this, profile, |
325 tab_contents->content_settings(), url, | 326 tab_contents->content_settings(), |
| 327 tab_contents->infobar_tab_helper(), |
| 328 url, |
326 ssl, | 329 ssl, |
327 content::CertStore::GetInstance())); | 330 content::CertStore::GetInstance())); |
328 } | 331 } |
329 } | 332 } |
330 | 333 |
331 void WebsiteSettingsPopupView::OnPermissionChanged( | 334 void WebsiteSettingsPopupView::OnPermissionChanged( |
332 PermissionSelectorView* permission_selector) { | 335 PermissionSelectorView* permission_selector) { |
333 DCHECK(permission_selector); | 336 DCHECK(permission_selector); |
334 presenter_->OnSitePermissionChanged( | 337 presenter_->OnSitePermissionChanged( |
335 permission_selector->GetPermissionType(), | 338 permission_selector->GetPermissionType(), |
336 permission_selector->GetSelectedSetting()); | 339 permission_selector->GetSelectedSetting()); |
337 } | 340 } |
338 | 341 |
339 gfx::Rect WebsiteSettingsPopupView::GetAnchorRect() { | 342 gfx::Rect WebsiteSettingsPopupView::GetAnchorRect() { |
340 // Compensate for some built-in padding in the icon. This will make the arrow | 343 // Compensate for some built-in padding in the icon. This will make the arrow |
341 // point to the middle of the icon. | 344 // point to the middle of the icon. |
342 gfx::Rect anchor(BubbleDelegateView::GetAnchorRect()); | 345 gfx::Rect anchor(BubbleDelegateView::GetAnchorRect()); |
343 anchor.Inset(0, anchor_view() ? kLocationIconBottomMargin : 0); | 346 anchor.Inset(0, anchor_view() ? kLocationIconBottomMargin : 0); |
344 return anchor; | 347 return anchor; |
345 } | 348 } |
346 | 349 |
| 350 void WebsiteSettingsPopupView::OnWidgetClosing(views::Widget* widget) { |
| 351 presenter_->OnUIClosing(); |
| 352 } |
| 353 |
347 void WebsiteSettingsPopupView::ButtonPressed( | 354 void WebsiteSettingsPopupView::ButtonPressed( |
348 views::Button* button, | 355 views::Button* button, |
349 const views::Event& event) { | 356 const views::Event& event) { |
350 GetWidget()->Close(); | 357 GetWidget()->Close(); |
351 } | 358 } |
352 | 359 |
353 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, | 360 void WebsiteSettingsPopupView::LinkClicked(views::Link* source, |
354 int event_flags) { | 361 int event_flags) { |
355 if (source == cookie_dialog_link_) { | 362 if (source == cookie_dialog_link_) { |
356 new CollectedCookiesViews(tab_contents_); | 363 new CollectedCookiesViews(tab_contents_); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 694 |
688 if (link) { | 695 if (link) { |
689 content_layout->StartRow(1, 0); | 696 content_layout->StartRow(1, 0); |
690 content_layout->AddView(link); | 697 content_layout->AddView(link); |
691 } | 698 } |
692 | 699 |
693 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, | 700 layout->AddView(content_pane, 1, 1, views::GridLayout::LEADING, |
694 views::GridLayout::LEADING); | 701 views::GridLayout::LEADING); |
695 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); | 702 layout->AddPaddingRow(0, kConnectionSectionPaddingBottom); |
696 } | 703 } |
OLD | NEW |