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