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/media/media_stream_capture_indicator.h" | 5 #include "chrome/browser/media/media_stream_capture_indicator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/prefs/pref_service.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
15 #include "chrome/browser/extensions/image_loader.h" | 16 #include "chrome/browser/extensions/image_loader.h" |
16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/status_icons/status_icon.h" | 18 #include "chrome/browser/status_icons/status_icon.h" |
18 #include "chrome/browser/status_icons/status_tray.h" | 19 #include "chrome/browser/status_icons/status_tray.h" |
19 #include "chrome/browser/tab_contents/tab_util.h" | 20 #include "chrome/browser/tab_contents/tab_util.h" |
20 #include "chrome/browser/ui/screen_capture_notification_ui.h" | 21 #include "chrome/browser/ui/screen_capture_notification_ui.h" |
21 #include "chrome/common/extensions/api/icons/icons_handler.h" | 22 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 23 #include "chrome/common/pref_names.h" |
22 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
24 #include "content/public/browser/invalidate_type.h" | 26 #include "content/public/browser/invalidate_type.h" |
25 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
26 #include "content/public/browser/web_contents_delegate.h" | 28 #include "content/public/browser/web_contents_delegate.h" |
27 #include "content/public/browser/web_contents_observer.h" | 29 #include "content/public/browser/web_contents_observer.h" |
28 #include "grit/chromium_strings.h" | 30 #include "grit/chromium_strings.h" |
29 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
30 #include "grit/theme_resources.h" | 32 #include "grit/theme_resources.h" |
31 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (extension) | 89 if (extension) |
88 return UTF8ToUTF16(extension->name()); | 90 return UTF8ToUTF16(extension->name()); |
89 | 91 |
90 string16 tab_title = web_contents->GetTitle(); | 92 string16 tab_title = web_contents->GetTitle(); |
91 | 93 |
92 if (tab_title.empty()) { | 94 if (tab_title.empty()) { |
93 // If the page's title is empty use its security originator. | 95 // If the page's title is empty use its security originator. |
94 tab_title = GetSecurityOrigin(web_contents); | 96 tab_title = GetSecurityOrigin(web_contents); |
95 } else { | 97 } else { |
96 // If the page's title matches its URL, use its security originator. | 98 // If the page's title matches its URL, use its security originator. |
| 99 Profile* profile = |
| 100 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
97 std::string languages = | 101 std::string languages = |
98 content::GetContentClient()->browser()->GetAcceptLangs( | 102 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
99 web_contents->GetBrowserContext()); | |
100 if (tab_title == net::FormatUrl(web_contents->GetURL(), languages)) | 103 if (tab_title == net::FormatUrl(web_contents->GetURL(), languages)) |
101 tab_title = GetSecurityOrigin(web_contents); | 104 tab_title = GetSecurityOrigin(web_contents); |
102 } | 105 } |
103 | 106 |
104 return tab_title; | 107 return tab_title; |
105 } | 108 } |
106 | 109 |
107 } // namespace | 110 } // namespace |
108 | 111 |
109 // Stores usage counts for all the capture devices associated with a single | 112 // Stores usage counts for all the capture devices associated with a single |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 } | 591 } |
589 | 592 |
590 UpdateNotificationUserInterface(); | 593 UpdateNotificationUserInterface(); |
591 } | 594 } |
592 | 595 |
593 void MediaStreamCaptureIndicator::OnStopScreenCapture( | 596 void MediaStreamCaptureIndicator::OnStopScreenCapture( |
594 const base::Closure& stop) { | 597 const base::Closure& stop) { |
595 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 598 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
596 stop.Run(); | 599 stop.Run(); |
597 } | 600 } |
OLD | NEW |