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 <string> | 7 #include <string> |
8 | 8 |
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/prefs/pref_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/status_icons/status_icon.h" | 16 #include "chrome/browser/status_icons/status_icon.h" |
17 #include "chrome/browser/status_icons/status_tray.h" | 17 #include "chrome/browser/status_icons/status_tray.h" |
18 #include "chrome/browser/tab_contents/tab_util.h" | 18 #include "chrome/browser/tab_contents/tab_util.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 21 #include "components/url_formatter/url_formatter.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
24 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
25 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
26 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
27 #include "net/base/net_util.h" | |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
31 | 31 |
32 #if defined(ENABLE_EXTENSIONS) | 32 #if defined(ENABLE_EXTENSIONS) |
33 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
34 #include "extensions/browser/extension_registry.h" | 34 #include "extensions/browser/extension_registry.h" |
35 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
36 #endif | 36 #endif |
37 | 37 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 if (tab_title.empty()) { | 106 if (tab_title.empty()) { |
107 // If the page's title is empty use its security originator. | 107 // If the page's title is empty use its security originator. |
108 tab_title = GetSecurityOrigin(web_contents); | 108 tab_title = GetSecurityOrigin(web_contents); |
109 } else { | 109 } else { |
110 // If the page's title matches its URL, use its security originator. | 110 // If the page's title matches its URL, use its security originator. |
111 Profile* profile = | 111 Profile* profile = |
112 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 112 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
113 std::string languages = | 113 std::string languages = |
114 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | 114 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); |
115 if (tab_title == net::FormatUrl(web_contents->GetURL(), languages)) | 115 if (tab_title == |
| 116 url_formatter::FormatUrl(web_contents->GetURL(), languages)) |
116 tab_title = GetSecurityOrigin(web_contents); | 117 tab_title = GetSecurityOrigin(web_contents); |
117 } | 118 } |
118 | 119 |
119 return tab_title; | 120 return tab_title; |
120 } | 121 } |
121 | 122 |
122 } // namespace | 123 } // namespace |
123 | 124 |
124 // Stores usage counts for all the capture devices associated with a single | 125 // Stores usage counts for all the capture devices associated with a single |
125 // WebContents instance. Instances of this class are owned by | 126 // WebContents instance. Instances of this class are owned by |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } else if (audio && !video) { | 467 } else if (audio && !video) { |
467 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 468 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
468 *image = *mic_image_; | 469 *image = *mic_image_; |
469 } else if (!audio && video) { | 470 } else if (!audio && video) { |
470 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 471 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
471 *image = *camera_image_; | 472 *image = *camera_image_; |
472 } | 473 } |
473 | 474 |
474 *tool_tip = l10n_util::GetStringUTF16(message_id); | 475 *tool_tip = l10n_util::GetStringUTF16(message_id); |
475 } | 476 } |
OLD | NEW |