| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/profiles/profile.h" | |
| 18 #include "chrome/browser/status_icons/status_icon.h" | 17 #include "chrome/browser/status_icons/status_icon.h" |
| 19 #include "chrome/browser/status_icons/status_tray.h" | 18 #include "chrome/browser/status_icons/status_tray.h" |
| 20 #include "chrome/browser/tab_contents/tab_util.h" | 19 #include "chrome/browser/tab_contents/tab_util.h" |
| 21 #include "chrome/common/pref_names.h" | |
| 22 #include "chrome/grit/chromium_strings.h" | 20 #include "chrome/grit/chromium_strings.h" |
| 23 #include "components/prefs/pref_service.h" | |
| 24 #include "components/url_formatter/elide_url.h" | 21 #include "components/url_formatter/elide_url.h" |
| 25 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
| 27 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 28 #include "content/public/browser/web_contents_delegate.h" | 25 #include "content/public/browser/web_contents_delegate.h" |
| 29 #include "content/public/browser/web_contents_observer.h" | 26 #include "content/public/browser/web_contents_observer.h" |
| 30 #include "grit/theme_resources.h" | 27 #include "grit/theme_resources.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/gfx/image/image_skia.h" | 30 #include "ui/gfx/image/image_skia.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 74 |
| 78 if (!web_contents) | 75 if (!web_contents) |
| 79 return base::string16(); | 76 return base::string16(); |
| 80 | 77 |
| 81 #if defined(ENABLE_EXTENSIONS) | 78 #if defined(ENABLE_EXTENSIONS) |
| 82 const extensions::Extension* const extension = GetExtension(web_contents); | 79 const extensions::Extension* const extension = GetExtension(web_contents); |
| 83 if (extension) | 80 if (extension) |
| 84 return base::UTF8ToUTF16(extension->name()); | 81 return base::UTF8ToUTF16(extension->name()); |
| 85 #endif | 82 #endif |
| 86 | 83 |
| 87 Profile* profile = | 84 return url_formatter::FormatUrlForSecurityDisplay(web_contents->GetURL()); |
| 88 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
| 89 std::string languages = | |
| 90 profile->GetPrefs()->GetString(prefs::kAcceptLanguages); | |
| 91 return url_formatter::FormatUrlForSecurityDisplay(web_contents->GetURL(), | |
| 92 languages); | |
| 93 } | 85 } |
| 94 | 86 |
| 95 } // namespace | 87 } // namespace |
| 96 | 88 |
| 97 // Stores usage counts for all the capture devices associated with a single | 89 // Stores usage counts for all the capture devices associated with a single |
| 98 // WebContents instance. Instances of this class are owned by | 90 // WebContents instance. Instances of this class are owned by |
| 99 // MediaStreamCaptureIndicator. They also observe for the destruction of their | 91 // MediaStreamCaptureIndicator. They also observe for the destruction of their |
| 100 // corresponding WebContents and trigger their own deletion from their | 92 // corresponding WebContents and trigger their own deletion from their |
| 101 // MediaStreamCaptureIndicator. | 93 // MediaStreamCaptureIndicator. |
| 102 class MediaStreamCaptureIndicator::WebContentsDeviceUsage | 94 class MediaStreamCaptureIndicator::WebContentsDeviceUsage |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 } else if (audio && !video) { | 431 } else if (audio && !video) { |
| 440 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; | 432 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY; |
| 441 *image = *mic_image_; | 433 *image = *mic_image_; |
| 442 } else if (!audio && video) { | 434 } else if (!audio && video) { |
| 443 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; | 435 message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY; |
| 444 *image = *camera_image_; | 436 *image = *camera_image_; |
| 445 } | 437 } |
| 446 | 438 |
| 447 *tool_tip = l10n_util::GetStringUTF16(message_id); | 439 *tool_tip = l10n_util::GetStringUTF16(message_id); |
| 448 } | 440 } |
| OLD | NEW |