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

Side by Side Diff: chrome/browser/ui/views/website_settings/website_settings_popup_view.cc

Issue 1314953009: Refactor WebsiteSettings to operate on a SecurityInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 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
OLDNEW
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/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 270 }
271 271
272 //////////////////////////////////////////////////////////////////////////////// 272 ////////////////////////////////////////////////////////////////////////////////
273 // WebsiteSettingsPopupView 273 // WebsiteSettingsPopupView
274 //////////////////////////////////////////////////////////////////////////////// 274 ////////////////////////////////////////////////////////////////////////////////
275 275
276 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { 276 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() {
277 } 277 }
278 278
279 // static 279 // static
280 void WebsiteSettingsPopupView::ShowPopup(views::View* anchor_view, 280 void WebsiteSettingsPopupView::ShowPopup(
281 const gfx::Rect& anchor_rect, 281 views::View* anchor_view,
282 Profile* profile, 282 const gfx::Rect& anchor_rect,
283 content::WebContents* web_contents, 283 Profile* profile,
284 const GURL& url, 284 content::WebContents* web_contents,
285 const content::SSLStatus& ssl) { 285 const GURL& url,
286 const SecurityStateModel::SecurityInfo& security_info) {
286 is_popup_showing = true; 287 is_popup_showing = true;
287 gfx::NativeView parent_window = 288 gfx::NativeView parent_window =
288 anchor_view ? nullptr : web_contents->GetNativeView(); 289 anchor_view ? nullptr : web_contents->GetNativeView();
289 if (InternalChromePage(url)) { 290 if (InternalChromePage(url)) {
290 // Use the concrete type so that SetAnchorRect() can be called as a friend. 291 // Use the concrete type so that SetAnchorRect() can be called as a friend.
291 InternalPageInfoPopupView* popup = 292 InternalPageInfoPopupView* popup =
292 new InternalPageInfoPopupView(anchor_view, parent_window); 293 new InternalPageInfoPopupView(anchor_view, parent_window);
293 if (!anchor_view) 294 if (!anchor_view)
294 popup->SetAnchorRect(anchor_rect); 295 popup->SetAnchorRect(anchor_rect);
295 popup->GetWidget()->Show(); 296 popup->GetWidget()->Show();
296 } else { 297 } else {
297 WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView( 298 WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView(
298 anchor_view, parent_window, profile, web_contents, url, ssl); 299 anchor_view, parent_window, profile, web_contents, url, security_info);
299 if (!anchor_view) 300 if (!anchor_view)
300 popup->SetAnchorRect(anchor_rect); 301 popup->SetAnchorRect(anchor_rect);
301 popup->GetWidget()->Show(); 302 popup->GetWidget()->Show();
302 } 303 }
303 } 304 }
304 305
305 // static 306 // static
306 bool WebsiteSettingsPopupView::IsPopupShowing() { 307 bool WebsiteSettingsPopupView::IsPopupShowing() {
307 return is_popup_showing; 308 return is_popup_showing;
308 } 309 }
309 310
310 WebsiteSettingsPopupView::WebsiteSettingsPopupView( 311 WebsiteSettingsPopupView::WebsiteSettingsPopupView(
311 views::View* anchor_view, 312 views::View* anchor_view,
312 gfx::NativeView parent_window, 313 gfx::NativeView parent_window,
313 Profile* profile, 314 Profile* profile,
314 content::WebContents* web_contents, 315 content::WebContents* web_contents,
315 const GURL& url, 316 const GURL& url,
316 const content::SSLStatus& ssl) 317 const SecurityStateModel::SecurityInfo& security_info)
317 : content::WebContentsObserver(web_contents), 318 : content::WebContentsObserver(web_contents),
318 BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), 319 BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT),
319 web_contents_(web_contents), 320 web_contents_(web_contents),
320 header_(nullptr), 321 header_(nullptr),
321 tabbed_pane_(nullptr), 322 tabbed_pane_(nullptr),
322 permissions_tab_(nullptr), 323 permissions_tab_(nullptr),
323 site_data_content_(nullptr), 324 site_data_content_(nullptr),
324 cookie_dialog_link_(nullptr), 325 cookie_dialog_link_(nullptr),
325 permissions_content_(nullptr), 326 permissions_content_(nullptr),
326 connection_tab_(nullptr), 327 connection_tab_(nullptr),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS); 376 DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS);
376 tabbed_pane_->set_listener(this); 377 tabbed_pane_->set_listener(this);
377 378
378 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, 379 set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft,
379 kPopupMarginBottom, kPopupMarginRight)); 380 kPopupMarginBottom, kPopupMarginRight));
380 381
381 views::BubbleDelegateView::CreateBubble(this); 382 views::BubbleDelegateView::CreateBubble(this);
382 383
383 presenter_.reset(new WebsiteSettings( 384 presenter_.reset(new WebsiteSettings(
384 this, profile, TabSpecificContentSettings::FromWebContents(web_contents), 385 this, profile, TabSpecificContentSettings::FromWebContents(web_contents),
385 web_contents, url, ssl, content::CertStore::GetInstance())); 386 web_contents, url, security_info, content::CertStore::GetInstance()));
386 } 387 }
387 388
388 void WebsiteSettingsPopupView::RenderFrameDeleted( 389 void WebsiteSettingsPopupView::RenderFrameDeleted(
389 content::RenderFrameHost* render_frame_host) { 390 content::RenderFrameHost* render_frame_host) {
390 if (render_frame_host == web_contents_->GetMainFrame()) { 391 if (render_frame_host == web_contents_->GetMainFrame()) {
391 GetWidget()->Close(); 392 GetWidget()->Close();
392 } 393 }
393 } 394 }
394 395
395 void WebsiteSettingsPopupView::OnPermissionChanged( 396 void WebsiteSettingsPopupView::OnPermissionChanged(
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 // desktop we should link to that here, too. 854 // desktop we should link to that here, too.
854 web_contents_->OpenURL(content::OpenURLParams( 855 web_contents_->OpenURL(content::OpenURLParams(
855 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(), 856 GURL(chrome::kChromeUIContentSettingsURL), content::Referrer(),
856 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false)); 857 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false));
857 presenter_->RecordWebsiteSettingsAction( 858 presenter_->RecordWebsiteSettingsAction(
858 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED); 859 WebsiteSettings::WEBSITE_SETTINGS_SITE_SETTINGS_OPENED);
859 } else { 860 } else {
860 NOTREACHED(); 861 NOTREACHED();
861 } 862 }
862 } 863 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698