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