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/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 } | 552 } |
553 | 553 |
554 /////////////////////////////////////////////////////////////////////////////// | 554 /////////////////////////////////////////////////////////////////////////////// |
555 // Browser, State Storage and Retrieval for UI: | 555 // Browser, State Storage and Retrieval for UI: |
556 | 556 |
557 SkBitmap Browser::GetCurrentPageIcon() const { | 557 SkBitmap Browser::GetCurrentPageIcon() const { |
558 TabContents* contents = chrome::GetActiveTabContents(this); | 558 TabContents* contents = chrome::GetActiveTabContents(this); |
559 // |contents| can be NULL since GetCurrentPageIcon() is called by the window | 559 // |contents| can be NULL since GetCurrentPageIcon() is called by the window |
560 // during the window's creation (before tabs have been added). | 560 // during the window's creation (before tabs have been added). |
561 // TODO: Let this return a gfx::Image. | 561 // TODO: Let this return a gfx::Image. |
562 return contents ? | 562 if (!contents) |
563 contents->favicon_tab_helper()->GetFavicon().AsBitmap() : SkBitmap(); | 563 return SkBitmap(); |
| 564 const gfx::Image& icon = contents->favicon_tab_helper()->GetFavicon(); |
| 565 return icon.IsEmpty() ? SkBitmap() : *icon.ToSkBitmap(); |
564 } | 566 } |
565 | 567 |
566 string16 Browser::GetWindowTitleForCurrentTab() const { | 568 string16 Browser::GetWindowTitleForCurrentTab() const { |
567 WebContents* contents = chrome::GetActiveWebContents(this); | 569 WebContents* contents = chrome::GetActiveWebContents(this); |
568 string16 title; | 570 string16 title; |
569 | 571 |
570 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the | 572 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the |
571 // window during the window's creation (before tabs have been added). | 573 // window during the window's creation (before tabs have been added). |
572 if (contents) { | 574 if (contents) { |
573 title = contents->GetTitle(); | 575 title = contents->GetTitle(); |
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 if (contents && !allow_js_access) { | 2321 if (contents && !allow_js_access) { |
2320 contents->web_contents()->GetController().LoadURL( | 2322 contents->web_contents()->GetController().LoadURL( |
2321 target_url, | 2323 target_url, |
2322 content::Referrer(), | 2324 content::Referrer(), |
2323 content::PAGE_TRANSITION_LINK, | 2325 content::PAGE_TRANSITION_LINK, |
2324 std::string()); // No extra headers. | 2326 std::string()); // No extra headers. |
2325 } | 2327 } |
2326 | 2328 |
2327 return contents != NULL; | 2329 return contents != NULL; |
2328 } | 2330 } |
OLD | NEW |