| 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (!extension) | 575 if (!extension) |
| 575 return base::string16(); | 576 return base::string16(); |
| 576 | 577 |
| 577 // WebContents::GetTitle() will return the page's URL if there's no <title> | 578 // WebContents::GetTitle() will return the page's URL if there's no <title> |
| 578 // specified. However, we'd prefer to show the name of the extension in that | 579 // specified. However, we'd prefer to show the name of the extension in that |
| 579 // case, so we directly inspect the NavigationEntry's title. | 580 // case, so we directly inspect the NavigationEntry's title. |
| 580 base::string16 title; | 581 base::string16 title; |
| 581 content::NavigationEntry* entry = web_contents() ? | 582 content::NavigationEntry* entry = web_contents() ? |
| 582 web_contents()->GetController().GetLastCommittedEntry() : nullptr; | 583 web_contents()->GetController().GetLastCommittedEntry() : nullptr; |
| 583 if (!entry || entry->GetTitle().empty()) { | 584 if (!entry || entry->GetTitle().empty()) { |
| 584 title = base::UTF8ToUTF16(extension->name()); | 585 if (!title_.empty()) { |
| 586 title = base::UTF8ToUTF16(title_); |
| 587 } else { |
| 588 title = base::UTF8ToUTF16(extension->name()); |
| 589 } |
| 585 } else { | 590 } else { |
| 586 title = web_contents()->GetTitle(); | 591 title = web_contents()->GetTitle(); |
| 587 } | 592 } |
| 588 base::RemoveChars(title, base::ASCIIToUTF16("\n"), &title); | 593 base::RemoveChars(title, base::ASCIIToUTF16("\n"), &title); |
| 589 return title; | 594 return title; |
| 590 } | 595 } |
| 591 | 596 |
| 592 void AppWindow::SetAppIconUrl(const GURL& url) { | 597 void AppWindow::SetAppIconUrl(const GURL& url) { |
| 593 // Avoid using any previous icons that were being downloaded. | 598 // Avoid using any previous icons that were being downloaded. |
| 594 image_loader_ptr_factory_.InvalidateWeakPtrs(); | 599 image_loader_ptr_factory_.InvalidateWeakPtrs(); |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 region.bounds.x(), | 1160 region.bounds.x(), |
| 1156 region.bounds.y(), | 1161 region.bounds.y(), |
| 1157 region.bounds.right(), | 1162 region.bounds.right(), |
| 1158 region.bounds.bottom(), | 1163 region.bounds.bottom(), |
| 1159 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 1164 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 1160 } | 1165 } |
| 1161 return sk_region; | 1166 return sk_region; |
| 1162 } | 1167 } |
| 1163 | 1168 |
| 1164 } // namespace extensions | 1169 } // namespace extensions |
| OLD | NEW |