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

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

Issue 6814029: Revert 80519 - Move favicon from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/web_applications/web_app_ui.h" 5 #include "chrome/browser/ui/web_applications/web_app_ui.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/win/windows_version.h" 10 #include "base/win/windows_version.h"
11 #include "chrome/browser/extensions/extension_tab_helper.h" 11 #include "chrome/browser/extensions/extension_tab_helper.h"
12 #include "chrome/browser/favicon_tab_helper.h"
13 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/web_applications/web_app.h" 13 #include "chrome/browser/web_applications/web_app.h"
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
16 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
17 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
18 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/common/notification_registrar.h" 18 #include "content/common/notification_registrar.h"
20 19
21 #if defined(OS_LINUX) 20 #if defined(OS_LINUX)
22 #include "base/environment.h" 21 #include "base/environment.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 DeleteMe(); // We are done if underlying TabContents is gone. 126 DeleteMe(); // We are done if underlying TabContents is gone.
128 return; 127 return;
129 } 128 }
130 129
131 if (unprocessed_icons_.empty()) { 130 if (unprocessed_icons_.empty()) {
132 // No app icon. Just use the favicon from TabContents. 131 // No app icon. Just use the favicon from TabContents.
133 UpdateShortcuts(); 132 UpdateShortcuts();
134 return; 133 return;
135 } 134 }
136 135
137 tab_contents_->favicon_tab_helper()->DownloadImage( 136 tab_contents_->tab_contents()->favicon_helper().DownloadImage(
138 unprocessed_icons_.back().url, 137 unprocessed_icons_.back().url,
139 std::max(unprocessed_icons_.back().width, 138 std::max(unprocessed_icons_.back().width,
140 unprocessed_icons_.back().height), 139 unprocessed_icons_.back().height),
141 NewCallback(this, &UpdateShortcutWorker::OnIconDownloaded)); 140 NewCallback(this, &UpdateShortcutWorker::OnIconDownloaded));
142 unprocessed_icons_.pop_back(); 141 unprocessed_icons_.pop_back();
143 } 142 }
144 143
145 void UpdateShortcutWorker::OnIconDownloaded(int download_id, 144 void UpdateShortcutWorker::OnIconDownloaded(int download_id,
146 bool errored, 145 bool errored,
147 const SkBitmap& image) { 146 const SkBitmap& image) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 const WebApplicationInfo& app_info = 296 const WebApplicationInfo& app_info =
298 tab_contents_wrapper->extension_tab_helper()->web_app_info(); 297 tab_contents_wrapper->extension_tab_helper()->web_app_info();
299 298
300 info->url = app_info.app_url.is_empty() ? tab_contents->GetURL() : 299 info->url = app_info.app_url.is_empty() ? tab_contents->GetURL() :
301 app_info.app_url; 300 app_info.app_url;
302 info->title = app_info.title.empty() ? 301 info->title = app_info.title.empty() ?
303 (tab_contents->GetTitle().empty() ? UTF8ToUTF16(info->url.spec()) : 302 (tab_contents->GetTitle().empty() ? UTF8ToUTF16(info->url.spec()) :
304 tab_contents->GetTitle()) : 303 tab_contents->GetTitle()) :
305 app_info.title; 304 app_info.title;
306 info->description = app_info.description; 305 info->description = app_info.description;
307 info->favicon = tab_contents_wrapper->favicon_tab_helper()->GetFavicon(); 306 info->favicon = tab_contents->GetFavicon();
308 } 307 }
309 308
310 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { 309 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) {
311 #if defined(OS_WIN) 310 #if defined(OS_WIN)
312 // UpdateShortcutWorker will delete itself when it's done. 311 // UpdateShortcutWorker will delete itself when it's done.
313 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); 312 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents);
314 worker->Run(); 313 worker->Run();
315 #endif // defined(OS_WIN) 314 #endif // defined(OS_WIN)
316 } 315 }
317 316
318 } // namespace web_app 317 } // namespace web_app
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698