OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "apps/app_window_geometry_cache.h" | 9 #include "apps/app_window_geometry_cache.h" |
10 #include "apps/app_window_registry.h" | 10 #include "apps/app_window_registry.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 return GetBaseWindow()->GetNativeWindow(); | 531 return GetBaseWindow()->GetNativeWindow(); |
532 } | 532 } |
533 | 533 |
534 gfx::Rect AppWindow::GetClientBounds() const { | 534 gfx::Rect AppWindow::GetClientBounds() const { |
535 gfx::Rect bounds = native_app_window_->GetBounds(); | 535 gfx::Rect bounds = native_app_window_->GetBounds(); |
536 bounds.Inset(native_app_window_->GetFrameInsets()); | 536 bounds.Inset(native_app_window_->GetFrameInsets()); |
537 return bounds; | 537 return bounds; |
538 } | 538 } |
539 | 539 |
540 base::string16 AppWindow::GetTitle() const { | 540 base::string16 AppWindow::GetTitle() const { |
541 base::string16 title; | |
542 const extensions::Extension* extension = GetExtension(); | 541 const extensions::Extension* extension = GetExtension(); |
543 if (!extension) | 542 if (!extension) |
544 return title; | 543 return base::string16(); |
545 | 544 |
546 // WebContents::GetTitle() will return the page's URL if there's no <title> | 545 // WebContents::GetTitle() will return the page's URL if there's no <title> |
547 // specified. However, we'd prefer to show the name of the extension in that | 546 // specified. However, we'd prefer to show the name of the extension in that |
548 // case, so we directly inspect the NavigationEntry's title. | 547 // case, so we directly inspect the NavigationEntry's title. |
| 548 base::string16 title; |
549 if (!web_contents() || !web_contents()->GetController().GetActiveEntry() || | 549 if (!web_contents() || !web_contents()->GetController().GetActiveEntry() || |
550 web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) { | 550 web_contents()->GetController().GetActiveEntry()->GetTitle().empty()) { |
551 title = base::UTF8ToUTF16(extension->name()); | 551 title = base::UTF8ToUTF16(extension->name()); |
552 } else { | 552 } else { |
553 title = web_contents()->GetTitle(); | 553 title = web_contents()->GetTitle(); |
554 } | 554 } |
555 const base::char16 kBadChars[] = {'\n', 0}; | 555 base::RemoveChars(title, base::ASCIIToUTF16("\n"), &title); |
556 base::RemoveChars(title, kBadChars, &title); | |
557 return title; | 556 return title; |
558 } | 557 } |
559 | 558 |
560 void AppWindow::SetAppIconUrl(const GURL& url) { | 559 void AppWindow::SetAppIconUrl(const GURL& url) { |
561 // If the same url is being used for the badge, ignore it. | 560 // If the same url is being used for the badge, ignore it. |
562 if (url == badge_icon_url_) | 561 if (url == badge_icon_url_) |
563 return; | 562 return; |
564 | 563 |
565 // Avoid using any previous icons that were being downloaded. | 564 // Avoid using any previous icons that were being downloaded. |
566 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 565 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 region.bounds.x(), | 1118 region.bounds.x(), |
1120 region.bounds.y(), | 1119 region.bounds.y(), |
1121 region.bounds.right(), | 1120 region.bounds.right(), |
1122 region.bounds.bottom(), | 1121 region.bounds.bottom(), |
1123 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1122 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1124 } | 1123 } |
1125 return sk_region; | 1124 return sk_region; |
1126 } | 1125 } |
1127 | 1126 |
1128 } // namespace apps | 1127 } // namespace apps |
OLD | NEW |