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/page_info/page_info_bubble_view.h" | 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 return ui::DIALOG_BUTTON_NONE; | 379 return ui::DIALOG_BUTTON_NONE; |
380 } | 380 } |
381 | 381 |
382 //////////////////////////////////////////////////////////////////////////////// | 382 //////////////////////////////////////////////////////////////////////////////// |
383 // PageInfoBubbleView | 383 // PageInfoBubbleView |
384 //////////////////////////////////////////////////////////////////////////////// | 384 //////////////////////////////////////////////////////////////////////////////// |
385 | 385 |
386 PageInfoBubbleView::~PageInfoBubbleView() {} | 386 PageInfoBubbleView::~PageInfoBubbleView() {} |
387 | 387 |
388 // static | 388 // static |
389 void PageInfoBubbleView::ShowBubble( | 389 views::BubbleDialogDelegateView* PageInfoBubbleView::ShowBubble( |
390 views::View* anchor_view, | 390 views::View* anchor_view, |
391 views::WidgetObserver* widget_observer, | 391 views::WidgetObserver* widget_observer, |
392 const gfx::Rect& anchor_rect, | 392 const gfx::Rect& anchor_rect, |
393 Profile* profile, | 393 Profile* profile, |
394 content::WebContents* web_contents, | 394 content::WebContents* web_contents, |
395 const GURL& url, | 395 const GURL& url, |
396 const security_state::SecurityInfo& security_info) { | 396 const security_state::SecurityInfo& security_info) { |
397 gfx::NativeView parent_window = | 397 gfx::NativeView parent_window = |
398 anchor_view ? nullptr : web_contents->GetNativeView(); | 398 anchor_view ? nullptr : web_contents->GetNativeView(); |
399 if (url.SchemeIs(content::kChromeUIScheme) || | 399 if (url.SchemeIs(content::kChromeUIScheme) || |
400 url.SchemeIs(content::kChromeDevToolsScheme) || | 400 url.SchemeIs(content::kChromeDevToolsScheme) || |
401 url.SchemeIs(extensions::kExtensionScheme) || | 401 url.SchemeIs(extensions::kExtensionScheme) || |
402 url.SchemeIs(content::kViewSourceScheme)) { | 402 url.SchemeIs(content::kViewSourceScheme)) { |
403 // Use the concrete type so that |SetAnchorRect| can be called as a friend. | 403 // Use the concrete type so that |SetAnchorRect| can be called as a friend. |
404 InternalPageInfoBubbleView* bubble = | 404 InternalPageInfoBubbleView* bubble = |
405 new InternalPageInfoBubbleView(anchor_view, parent_window, url); | 405 new InternalPageInfoBubbleView(anchor_view, parent_window, url); |
406 if (!anchor_view) | 406 if (!anchor_view) |
407 bubble->SetAnchorRect(anchor_rect); | 407 bubble->SetAnchorRect(anchor_rect); |
408 if (widget_observer) | 408 if (widget_observer) |
409 bubble->GetWidget()->AddObserver(widget_observer); | 409 bubble->GetWidget()->AddObserver(widget_observer); |
410 bubble->GetWidget()->Show(); | 410 bubble->GetWidget()->Show(); |
411 return; | 411 return bubble; |
412 } | 412 } |
413 PageInfoBubbleView* bubble = new PageInfoBubbleView( | 413 PageInfoBubbleView* bubble = new PageInfoBubbleView( |
414 anchor_view, parent_window, profile, web_contents, url, security_info); | 414 anchor_view, parent_window, profile, web_contents, url, security_info); |
415 if (!anchor_view) | 415 if (!anchor_view) |
416 bubble->SetAnchorRect(anchor_rect); | 416 bubble->SetAnchorRect(anchor_rect); |
417 if (widget_observer) | 417 if (widget_observer) |
418 bubble->GetWidget()->AddObserver(widget_observer); | 418 bubble->GetWidget()->AddObserver(widget_observer); |
419 bubble->GetWidget()->Show(); | 419 bubble->GetWidget()->Show(); |
| 420 return bubble; |
420 } | 421 } |
421 | 422 |
422 // static | 423 // static |
423 PageInfoBubbleView::BubbleType PageInfoBubbleView::GetShownBubbleType() { | 424 PageInfoBubbleView::BubbleType PageInfoBubbleView::GetShownBubbleType() { |
424 return g_shown_bubble_type; | 425 return g_shown_bubble_type; |
425 } | 426 } |
426 | 427 |
427 PageInfoBubbleView::PageInfoBubbleView( | 428 PageInfoBubbleView::PageInfoBubbleView( |
428 views::View* anchor_view, | 429 views::View* anchor_view, |
429 gfx::NativeView parent_window, | 430 gfx::NativeView parent_window, |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); | 792 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); |
792 break; | 793 break; |
793 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: | 794 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: |
794 presenter_->OnRevokeSSLErrorBypassButtonPressed(); | 795 presenter_->OnRevokeSSLErrorBypassButtonPressed(); |
795 GetWidget()->Close(); | 796 GetWidget()->Close(); |
796 break; | 797 break; |
797 default: | 798 default: |
798 NOTREACHED(); | 799 NOTREACHED(); |
799 } | 800 } |
800 } | 801 } |
OLD | NEW |