Chromium Code Reviews| Index: chrome/browser/ui/panels/panel.cc |
| diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc |
| index 35900ca68d4845adbbeb4120fc7f36f96116905f..5bfa530383bdb94d1dccb85cefd01ed3748f552f 100644 |
| --- a/chrome/browser/ui/panels/panel.cc |
| +++ b/chrome/browser/ui/panels/panel.cc |
| @@ -25,6 +25,7 @@ |
| #include "chrome/browser/ui/panels/panel_collection.h" |
| #include "chrome/browser/ui/panels/panel_host.h" |
| #include "chrome/browser/ui/panels/panel_manager.h" |
| +#include "chrome/browser/ui/panels/stacked_panel_collection.h" |
| #include "chrome/browser/web_applications/web_app.h" |
| #include "chrome/common/chrome_notification_types.h" |
| #include "chrome/common/extensions/extension.h" |
| @@ -245,6 +246,11 @@ const std::string Panel::extension_id() const { |
| return web_app::GetExtensionIdFromApplicationName(app_name_); |
| } |
| +StackedPanelCollection* Panel::stack() const { |
| + return collection_->type() == PanelCollection::STACKED ? |
| + static_cast<StackedPanelCollection*>(collection_) : NULL; |
| +} |
| + |
| content::WebContents* Panel::GetWebContents() const { |
| return panel_host_.get() ? panel_host_->web_contents() : NULL; |
| } |
| @@ -766,19 +772,19 @@ void Panel::OnWindowClosing() { |
| } |
| string16 Panel::GetWindowTitle() const { |
| - content::WebContents* contents = GetWebContents(); |
| - string16 title; |
| - |
| // |contents| can be NULL during the window's creation. |
| + content::WebContents* contents = GetWebContents(); |
| if (contents) { |
| - title = contents->GetTitle(); |
| + string16 title = contents->GetTitle(); |
| FormatTitleForDisplay(&title); |
| + if (!title.empty()) |
| + return title; |
| } |
| - if (title.empty()) |
| - title = UTF8ToUTF16(app_name()); |
| - |
| - return title; |
| + // Then try the extension manifest name. At last, app name is used. |
|
Dmitry Titov
2013/01/09 02:29:50
This is unrelated change. Can it be moved to a sep
jianli
2013/01/09 21:00:59
Done.
|
| + const extensions::Extension* extension = GetExtension(); |
| + return UTF8ToUTF16(extension && !extension->name().empty() ? |
| + extension->name() : app_name()); |
| } |
| // static |
| @@ -809,6 +815,16 @@ void Panel::WebContentsFocused(content::WebContents* contents) { |
| native_panel_->PanelWebContentsFocused(contents); |
| } |
| +void Panel::UpdateStackingProperty() { |
| + native_panel_->UpdatePanelStackingProperty(); |
| +} |
| + |
| +void Panel::MoveBy(const gfx::Vector2d& delta_origin) { |
|
Dmitry Titov
2013/01/09 02:29:50
Naming: MoveByInstantly would better reflect what
jianli
2013/01/09 21:00:59
Done.
|
| + gfx::Rect bounds = GetBounds(); |
| + bounds.Offset(delta_origin); |
| + SetPanelBoundsInstantly(bounds); |
| +} |
| + |
| const extensions::Extension* Panel::GetExtension() const { |
| ExtensionService* extension_service = |
| extensions::ExtensionSystem::Get(profile())->extension_service(); |