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/ui/panels/panel.h" | 5 #include "chrome/browser/ui/panels/panel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
434 void Panel::Observe(int type, | 434 void Panel::Observe(int type, |
435 const content::NotificationSource& source, | 435 const content::NotificationSource& source, |
436 const content::NotificationDetails& details) { | 436 const content::NotificationDetails& details) { |
437 switch (type) { | 437 switch (type) { |
438 case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: | 438 case content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED: |
439 ConfigureAutoResize(content::Source<content::WebContents>(source).ptr()); | 439 ConfigureAutoResize(content::Source<content::WebContents>(source).ptr()); |
440 break; | 440 break; |
441 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 441 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
442 if (content::Details<extensions::UnloadedExtensionInfo>( | 442 if (content::Details<extensions::UnloadedExtensionInfo>( |
443 details)->extension->id() == extension_id()) | 443 details)->extension->id() == extension_id()) |
444 Close(); | 444 Close(); |
445 break; | 445 break; |
446 case chrome::NOTIFICATION_APP_TERMINATING: | 446 case chrome::NOTIFICATION_APP_TERMINATING: |
447 Close(); | 447 Close(); |
448 break; | 448 break; |
449 default: | 449 default: |
450 NOTREACHED() << "Received unexpected notification " << type; | 450 NOTREACHED() << "Received unexpected notification " << type; |
451 } | 451 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 524 |
525 // Set up hosting for web contents. | 525 // Set up hosting for web contents. |
526 panel_host_.reset(new PanelHost(this, profile_)); | 526 panel_host_.reset(new PanelHost(this, profile_)); |
527 panel_host_->Init(url); | 527 panel_host_->Init(url); |
528 content::WebContents* web_contents = GetWebContents(); | 528 content::WebContents* web_contents = GetWebContents(); |
529 // The contents might be NULL for most of our tests. | 529 // The contents might be NULL for most of our tests. |
530 if (web_contents) | 530 if (web_contents) |
531 native_panel_->AttachWebContents(web_contents); | 531 native_panel_->AttachWebContents(web_contents); |
532 | 532 |
533 // Close when the extension is unloaded or the browser is exiting. | 533 // Close when the extension is unloaded or the browser is exiting. |
534 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 534 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
535 content::Source<Profile>(profile_)); | 535 content::Source<Profile>(profile_)); |
536 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, | 536 registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING, |
537 content::NotificationService::AllSources()); | 537 content::NotificationService::AllSources()); |
538 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 538 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
539 content::Source<ThemeService>( | 539 content::Source<ThemeService>( |
540 ThemeServiceFactory::GetForProfile(profile_))); | 540 ThemeServiceFactory::GetForProfile(profile_))); |
541 | 541 |
542 #if !defined(USE_AURA) | 542 #if !defined(USE_AURA) |
543 // Keep alive for AURA has been moved to panel_view. | 543 // Keep alive for AURA has been moved to panel_view. |
544 // Prevent the browser process from shutting down while this window is open. | 544 // Prevent the browser process from shutting down while this window is open. |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 // static | 893 // static |
894 void Panel::FormatTitleForDisplay(base::string16* title) { | 894 void Panel::FormatTitleForDisplay(base::string16* title) { |
895 size_t current_index = 0; | 895 size_t current_index = 0; |
896 size_t match_index; | 896 size_t match_index; |
897 while ((match_index = title->find(L'\n', current_index)) != | 897 while ((match_index = title->find(L'\n', current_index)) != |
898 base::string16::npos) { | 898 base::string16::npos) { |
899 title->replace(match_index, 1, base::string16()); | 899 title->replace(match_index, 1, base::string16()); |
900 current_index = match_index; | 900 current_index = match_index; |
901 } | 901 } |
902 } | 902 } |
OLD | NEW |