OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/infobars/infobar_service.h" | 5 #include "chrome/browser/infobars/infobar_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" | 9 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
11 #include "components/infobars/core/infobar.h" | 11 #include "components/infobars/core/infobar.h" |
12 #include "content/public/browser/navigation_details.h" | 12 #include "content/public/browser/navigation_details.h" |
13 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
14 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 | 16 |
17 DEFINE_WEB_CONTENTS_USER_DATA_KEY(InfoBarService); | 17 DEFINE_WEB_CONTENTS_USER_DATA_KEY(InfoBarService); |
18 | 18 |
19 using infobars::InfoBar; | 19 using infobars::InfoBar; |
20 using infobars::InfoBarDelegate; | 20 using infobars::InfoBarDelegate; |
21 using infobars::InfoBarManager; | 21 using infobars::InfoBarManager; |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 bool IsReload(const content::LoadCommittedDetails& details) { | 25 bool IsReload(const content::LoadCommittedDetails& details) { |
26 return content::PageTransitionStripQualifier( | 26 return ui::PageTransitionStripQualifier( |
27 details.entry->GetTransitionType()) == content::PAGE_TRANSITION_RELOAD; | 27 details.entry->GetTransitionType()) == ui::PAGE_TRANSITION_RELOAD; |
28 | 28 |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 // static | 33 // static |
34 InfoBarDelegate::NavigationDetails | 34 InfoBarDelegate::NavigationDetails |
35 InfoBarService::NavigationDetailsFromLoadCommittedDetails( | 35 InfoBarService::NavigationDetailsFromLoadCommittedDetails( |
36 const content::LoadCommittedDetails& details) { | 36 const content::LoadCommittedDetails& details) { |
37 InfoBarDelegate::NavigationDetails navigation_details; | 37 InfoBarDelegate::NavigationDetails navigation_details; |
38 navigation_details.entry_id = details.entry->GetUniqueID(); | 38 navigation_details.entry_id = details.entry->GetUniqueID(); |
39 navigation_details.is_navigation_to_different_page = | 39 navigation_details.is_navigation_to_different_page = |
40 details.is_navigation_to_different_page(); | 40 details.is_navigation_to_different_page(); |
41 navigation_details.did_replace_entry = details.did_replace_entry; | 41 navigation_details.did_replace_entry = details.did_replace_entry; |
42 navigation_details.is_main_frame = details.is_main_frame; | 42 navigation_details.is_main_frame = details.is_main_frame; |
43 | 43 |
44 const content::PageTransition transition = details.entry->GetTransitionType(); | 44 const ui::PageTransition transition = details.entry->GetTransitionType(); |
45 navigation_details.is_reload = IsReload(details); | 45 navigation_details.is_reload = IsReload(details); |
46 navigation_details.is_redirect = | 46 navigation_details.is_redirect = |
47 (transition & content::PAGE_TRANSITION_IS_REDIRECT_MASK) != 0; | 47 (transition & ui::PAGE_TRANSITION_IS_REDIRECT_MASK) != 0; |
48 | 48 |
49 return navigation_details; | 49 return navigation_details; |
50 } | 50 } |
51 | 51 |
52 // static | 52 // static |
53 content::WebContents* InfoBarService::WebContentsFromInfoBar(InfoBar* infobar) { | 53 content::WebContents* InfoBarService::WebContentsFromInfoBar(InfoBar* infobar) { |
54 if (!infobar || !infobar->owner()) | 54 if (!infobar || !infobar->owner()) |
55 return NULL; | 55 return NULL; |
56 InfoBarService* infobar_service = | 56 InfoBarService* infobar_service = |
57 static_cast<InfoBarService*>(infobar->owner()); | 57 static_cast<InfoBarService*>(infobar->owner()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 void InfoBarService::OnDidBlockDisplayingInsecureContent() { | 137 void InfoBarService::OnDidBlockDisplayingInsecureContent() { |
138 InsecureContentInfoBarDelegate::Create( | 138 InsecureContentInfoBarDelegate::Create( |
139 this, InsecureContentInfoBarDelegate::DISPLAY); | 139 this, InsecureContentInfoBarDelegate::DISPLAY); |
140 } | 140 } |
141 | 141 |
142 void InfoBarService::OnDidBlockRunningInsecureContent() { | 142 void InfoBarService::OnDidBlockRunningInsecureContent() { |
143 InsecureContentInfoBarDelegate::Create(this, | 143 InsecureContentInfoBarDelegate::Create(this, |
144 InsecureContentInfoBarDelegate::RUN); | 144 InsecureContentInfoBarDelegate::RUN); |
145 } | 145 } |
OLD | NEW |