| 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/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/image_loader.h" | 15 #include "chrome/browser/extensions/image_loader.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/status_icons/status_icon.h" | 17 #include "chrome/browser/status_icons/status_icon.h" |
| 18 #include "chrome/browser/status_icons/status_tray.h" | 18 #include "chrome/browser/status_icons/status_tray.h" |
| 19 #include "chrome/browser/tab_contents/tab_util.h" | 19 #include "chrome/browser/tab_contents/tab_util.h" |
| 20 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/content_browser_client.h" | 22 #include "content/public/browser/content_browser_client.h" |
| 22 #include "content/public/browser/invalidate_type.h" | 23 #include "content/public/browser/invalidate_type.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/chromium_strings.h" | 27 #include "grit/chromium_strings.h" |
| 27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 29 #include "net/base/net_util.h" | 30 #include "net/base/net_util.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 324 |
| 324 string16 message = | 325 string16 message = |
| 325 l10n_util::GetStringFUTF16(balloon_body_message_id, | 326 l10n_util::GetStringFUTF16(balloon_body_message_id, |
| 326 UTF8ToUTF16(extension->name())); | 327 UTF8ToUTF16(extension->name())); |
| 327 Profile* profile = | 328 Profile* profile = |
| 328 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 329 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 329 | 330 |
| 330 should_show_balloon_ = true; | 331 should_show_balloon_ = true; |
| 331 extensions::ImageLoader::Get(profile)->LoadImageAsync( | 332 extensions::ImageLoader::Get(profile)->LoadImageAsync( |
| 332 extension, | 333 extension, |
| 333 extension->GetIconResource(32, ExtensionIconSet::MATCH_BIGGER), | 334 extensions::IconsInfo::GetIconResource( |
| 335 extension, 32, ExtensionIconSet::MATCH_BIGGER), |
| 334 gfx::Size(32, 32), | 336 gfx::Size(32, 32), |
| 335 base::Bind(&MediaStreamCaptureIndicator::OnImageLoaded, | 337 base::Bind(&MediaStreamCaptureIndicator::OnImageLoaded, |
| 336 this, message)); | 338 this, message)); |
| 337 } | 339 } |
| 338 | 340 |
| 339 void MediaStreamCaptureIndicator::OnImageLoaded( | 341 void MediaStreamCaptureIndicator::OnImageLoaded( |
| 340 const string16& message, | 342 const string16& message, |
| 341 const gfx::Image& image) { | 343 const gfx::Image& image) { |
| 342 if (!should_show_balloon_ || !status_icon_) | 344 if (!should_show_balloon_ || !status_icon_) |
| 343 return; | 345 return; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 543 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 542 | 544 |
| 543 WebContents* const web_contents = | 545 WebContents* const web_contents = |
| 544 LookUpByKnownAlias(render_process_id, render_view_id); | 546 LookUpByKnownAlias(render_process_id, render_view_id); |
| 545 if (!web_contents) | 547 if (!web_contents) |
| 546 return false; | 548 return false; |
| 547 | 549 |
| 548 UsageMap::const_iterator it = usage_map_.find(web_contents); | 550 UsageMap::const_iterator it = usage_map_.find(web_contents); |
| 549 return it != usage_map_.end() && it->second->IsMirroring(); | 551 return it != usage_map_.end() && it->second->IsMirroring(); |
| 550 } | 552 } |
| OLD | NEW |