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 "extensions/browser/app_window/app_window.h" | 5 #include "extensions/browser/app_window/app_window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 // Windows cannot be always-on-top in fullscreen mode for security reasons. | 294 // Windows cannot be always-on-top in fullscreen mode for security reasons. |
295 cached_always_on_top_ = new_params.always_on_top; | 295 cached_always_on_top_ = new_params.always_on_top; |
296 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) | 296 if (new_params.state == ui::SHOW_STATE_FULLSCREEN) |
297 new_params.always_on_top = false; | 297 new_params.always_on_top = false; |
298 | 298 |
299 requested_alpha_enabled_ = new_params.alpha_enabled; | 299 requested_alpha_enabled_ = new_params.alpha_enabled; |
300 is_ime_window_ = params.is_ime_window; | 300 is_ime_window_ = params.is_ime_window; |
301 show_in_shelf_ = params.show_in_shelf; | 301 show_in_shelf_ = params.show_in_shelf; |
302 window_icon_url_ = params.window_icon_url; | 302 window_icon_url_ = params.window_icon_url; |
| 303 title_ = params.title; |
303 | 304 |
304 AppWindowClient* app_window_client = AppWindowClient::Get(); | 305 AppWindowClient* app_window_client = AppWindowClient::Get(); |
305 native_app_window_.reset( | 306 native_app_window_.reset( |
306 app_window_client->CreateNativeAppWindow(this, &new_params)); | 307 app_window_client->CreateNativeAppWindow(this, &new_params)); |
307 | 308 |
308 helper_.reset(new AppWebContentsHelper( | 309 helper_.reset(new AppWebContentsHelper( |
309 browser_context_, extension_id_, web_contents(), app_delegate_.get())); | 310 browser_context_, extension_id_, web_contents(), app_delegate_.get())); |
310 | 311 |
311 UpdateExtensionAppIcon(); | 312 UpdateExtensionAppIcon(); |
312 // Download showInShelf=true window icon. | 313 // Download showInShelf=true window icon. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 if (!extension) | 582 if (!extension) |
582 return base::string16(); | 583 return base::string16(); |
583 | 584 |
584 // WebContents::GetTitle() will return the page's URL if there's no <title> | 585 // WebContents::GetTitle() will return the page's URL if there's no <title> |
585 // specified. However, we'd prefer to show the name of the extension in that | 586 // specified. However, we'd prefer to show the name of the extension in that |
586 // case, so we directly inspect the NavigationEntry's title. | 587 // case, so we directly inspect the NavigationEntry's title. |
587 base::string16 title; | 588 base::string16 title; |
588 content::NavigationEntry* entry = web_contents() ? | 589 content::NavigationEntry* entry = web_contents() ? |
589 web_contents()->GetController().GetLastCommittedEntry() : nullptr; | 590 web_contents()->GetController().GetLastCommittedEntry() : nullptr; |
590 if (!entry || entry->GetTitle().empty()) { | 591 if (!entry || entry->GetTitle().empty()) { |
591 title = base::UTF8ToUTF16(extension->name()); | 592 if (!title_.empty()) { |
| 593 title = base::UTF8ToUTF16(title_); |
| 594 } else { |
| 595 title = base::UTF8ToUTF16(extension->name()); |
| 596 } |
592 } else { | 597 } else { |
593 title = web_contents()->GetTitle(); | 598 title = web_contents()->GetTitle(); |
594 } | 599 } |
595 base::RemoveChars(title, base::ASCIIToUTF16("\n"), &title); | 600 base::RemoveChars(title, base::ASCIIToUTF16("\n"), &title); |
596 return title; | 601 return title; |
597 } | 602 } |
598 | 603 |
599 void AppWindow::SetAppIconUrl(const GURL& url) { | 604 void AppWindow::SetAppIconUrl(const GURL& url) { |
600 // Avoid using any previous icons that were being downloaded. | 605 // Avoid using any previous icons that were being downloaded. |
601 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 606 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 region.bounds.x(), | 1167 region.bounds.x(), |
1163 region.bounds.y(), | 1168 region.bounds.y(), |
1164 region.bounds.right(), | 1169 region.bounds.right(), |
1165 region.bounds.bottom(), | 1170 region.bounds.bottom(), |
1166 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1171 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
1167 } | 1172 } |
1168 return sk_region; | 1173 return sk_region; |
1169 } | 1174 } |
1170 | 1175 |
1171 } // namespace extensions | 1176 } // namespace extensions |
OLD | NEW |