Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 6735042: Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/browser/download/download_shelf.h" 42 #include "chrome/browser/download/download_shelf.h"
43 #include "chrome/browser/download/download_started_animation.h" 43 #include "chrome/browser/download/download_started_animation.h"
44 #include "chrome/browser/extensions/crx_installer.h" 44 #include "chrome/browser/extensions/crx_installer.h"
45 #include "chrome/browser/extensions/extension_browser_event_router.h" 45 #include "chrome/browser/extensions/extension_browser_event_router.h"
46 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" 46 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
47 #include "chrome/browser/extensions/extension_host.h" 47 #include "chrome/browser/extensions/extension_host.h"
48 #include "chrome/browser/extensions/extension_prefs.h" 48 #include "chrome/browser/extensions/extension_prefs.h"
49 #include "chrome/browser/extensions/extension_service.h" 49 #include "chrome/browser/extensions/extension_service.h"
50 #include "chrome/browser/extensions/extension_tab_helper.h" 50 #include "chrome/browser/extensions/extension_tab_helper.h"
51 #include "chrome/browser/extensions/extension_tabs_module.h" 51 #include "chrome/browser/extensions/extension_tabs_module.h"
52 #include "chrome/browser/favicon_tab_helper.h"
52 #include "chrome/browser/first_run/first_run.h" 53 #include "chrome/browser/first_run/first_run.h"
53 #include "chrome/browser/google/google_url_tracker.h" 54 #include "chrome/browser/google/google_url_tracker.h"
54 #include "chrome/browser/google/google_util.h" 55 #include "chrome/browser/google/google_util.h"
55 #include "chrome/browser/instant/instant_controller.h" 56 #include "chrome/browser/instant/instant_controller.h"
56 #include "chrome/browser/instant/instant_unload_handler.h" 57 #include "chrome/browser/instant/instant_unload_handler.h"
57 #include "chrome/browser/metrics/user_metrics.h" 58 #include "chrome/browser/metrics/user_metrics.h"
58 #include "chrome/browser/net/browser_url_util.h" 59 #include "chrome/browser/net/browser_url_util.h"
59 #include "chrome/browser/net/url_fixer_upper.h" 60 #include "chrome/browser/net/url_fixer_upper.h"
60 #include "chrome/browser/notifications/notification_ui_manager.h" 61 #include "chrome/browser/notifications/notification_ui_manager.h"
61 #include "chrome/browser/platform_util.h" 62 #include "chrome/browser/platform_util.h"
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 807
807 // An explicit maximized state was not set. Query the window sizer. 808 // An explicit maximized state was not set. Query the window sizer.
808 gfx::Rect restored_bounds; 809 gfx::Rect restored_bounds;
809 bool maximized = false; 810 bool maximized = false;
810 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, 811 WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this,
811 &restored_bounds, &maximized); 812 &restored_bounds, &maximized);
812 return maximized; 813 return maximized;
813 } 814 }
814 815
815 SkBitmap Browser::GetCurrentPageIcon() const { 816 SkBitmap Browser::GetCurrentPageIcon() const {
816 TabContents* contents = GetSelectedTabContents(); 817 TabContentsWrapper* contents = GetSelectedTabContentsWrapper();
817 // |contents| can be NULL since GetCurrentPageIcon() is called by the window 818 // |contents| can be NULL since GetCurrentPageIcon() is called by the window
818 // during the window's creation (before tabs have been added). 819 // during the window's creation (before tabs have been added).
819 return contents ? contents->GetFavicon() : SkBitmap(); 820 return contents ? contents->favicon_tab_helper()->GetFavicon() : SkBitmap();
820 } 821 }
821 822
822 string16 Browser::GetWindowTitleForCurrentTab() const { 823 string16 Browser::GetWindowTitleForCurrentTab() const {
823 TabContents* contents = GetSelectedTabContents(); 824 TabContents* contents = GetSelectedTabContents();
824 string16 title; 825 string16 title;
825 826
826 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the 827 // |contents| can be NULL because GetWindowTitleForCurrentTab is called by the
827 // window during the window's creation (before tabs have been added). 828 // window during the window's creation (before tabs have been added).
828 if (contents) { 829 if (contents) {
829 title = contents->GetTitle(); 830 title = contents->GetTitle();
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 1582
1582 void Browser::BookmarkCurrentPage() { 1583 void Browser::BookmarkCurrentPage() {
1583 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_); 1584 UserMetrics::RecordAction(UserMetricsAction("Star"), profile_);
1584 1585
1585 BookmarkModel* model = profile()->GetBookmarkModel(); 1586 BookmarkModel* model = profile()->GetBookmarkModel();
1586 if (!model || !model->IsLoaded()) 1587 if (!model || !model->IsLoaded())
1587 return; // Ignore requests until bookmarks are loaded. 1588 return; // Ignore requests until bookmarks are loaded.
1588 1589
1589 GURL url; 1590 GURL url;
1590 string16 title; 1591 string16 title;
1591 TabContents* tab = GetSelectedTabContents(); 1592 TabContentsWrapper* tab = GetSelectedTabContentsWrapper();
1592 bookmark_utils::GetURLAndTitleToBookmark(tab, &url, &title); 1593 bookmark_utils::GetURLAndTitleToBookmark(tab->tab_contents(), &url, &title);
1593 bool was_bookmarked = model->IsBookmarked(url); 1594 bool was_bookmarked = model->IsBookmarked(url);
1594 if (!was_bookmarked && profile_->IsOffTheRecord()) { 1595 if (!was_bookmarked && profile_->IsOffTheRecord()) {
1595 // If we're incognito the favicon may not have been saved. Save it now 1596 // If we're incognito the favicon may not have been saved. Save it now
1596 // so that bookmarks have an icon for the page. 1597 // so that bookmarks have an icon for the page.
1597 tab->SaveFavicon(); 1598 tab->favicon_tab_helper()->SaveFavicon();
1598 } 1599 }
1599 model->SetURLStarred(url, title, true); 1600 model->SetURLStarred(url, title, true);
1600 // Make sure the model actually added a bookmark before showing the star. A 1601 // Make sure the model actually added a bookmark before showing the star. A
1601 // bookmark isn't created if the url is invalid. 1602 // bookmark isn't created if the url is invalid.
1602 if (window_->IsActive() && model->IsBookmarked(url)) { 1603 if (window_->IsActive() && model->IsBookmarked(url)) {
1603 // Only show the bubble if the window is active, otherwise we may get into 1604 // Only show the bubble if the window is active, otherwise we may get into
1604 // weird situations were the bubble is deleted as soon as it is shown. 1605 // weird situations were the bubble is deleted as soon as it is shown.
1605 window_->ShowBookmarkBubble(url, was_bookmarked); 1606 window_->ShowBookmarkBubble(url, was_bookmarked);
1606 } 1607 }
1607 } 1608 }
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after
4415 // The page transition below is only for the purpose of inserting the tab. 4416 // The page transition below is only for the purpose of inserting the tab.
4416 browser->AddTab(view_source_contents, PageTransition::LINK); 4417 browser->AddTab(view_source_contents, PageTransition::LINK);
4417 } 4418 }
4418 4419
4419 if (profile_->HasSessionService()) { 4420 if (profile_->HasSessionService()) {
4420 SessionService* session_service = profile_->GetSessionService(); 4421 SessionService* session_service = profile_->GetSessionService();
4421 if (session_service) 4422 if (session_service)
4422 session_service->TabRestored(&view_source_contents->controller(), false); 4423 session_service->TabRestored(&view_source_contents->controller(), false);
4423 } 4424 }
4424 } 4425 }
OLDNEW
« no previous file with comments | « chrome/browser/task_manager/task_manager_resource_providers.cc ('k') | chrome/browser/ui/cocoa/hung_renderer_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698