OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/launcher/chrome_launcher_controller_impl.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 } | 1321 } |
1322 | 1322 |
1323 void ChromeLauncherControllerImpl::CreateBrowserShortcutLauncherItem() { | 1323 void ChromeLauncherControllerImpl::CreateBrowserShortcutLauncherItem() { |
1324 ash::ShelfItem browser_shortcut; | 1324 ash::ShelfItem browser_shortcut; |
1325 browser_shortcut.type = ash::TYPE_BROWSER_SHORTCUT; | 1325 browser_shortcut.type = ash::TYPE_BROWSER_SHORTCUT; |
1326 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1326 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
1327 browser_shortcut.image = *rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_32); | 1327 browser_shortcut.image = *rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_32); |
1328 browser_shortcut.title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); | 1328 browser_shortcut.title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); |
1329 ash::ShelfID id = model_->next_id(); | 1329 ash::ShelfID id = model_->next_id(); |
1330 model_->AddAt(0, browser_shortcut); | 1330 model_->AddAt(0, browser_shortcut); |
1331 id_to_item_controller_map_[id] = | 1331 BrowserShortcutLauncherItemController* controller = |
1332 new BrowserShortcutLauncherItemController(this, model_); | 1332 new BrowserShortcutLauncherItemController(this, model_); |
1333 id_to_item_controller_map_[id]->set_shelf_id(id); | 1333 controller->set_shelf_id(id); |
| 1334 id_to_item_controller_map_[id] = controller; |
1334 // ShelfModel owns BrowserShortcutLauncherItemController. | 1335 // ShelfModel owns BrowserShortcutLauncherItemController. |
1335 SetShelfItemDelegate(id, id_to_item_controller_map_[id]); | 1336 SetShelfItemDelegate(id, controller); |
| 1337 controller->UpdateBrowserItemState(); |
1336 } | 1338 } |
1337 | 1339 |
1338 bool ChromeLauncherControllerImpl::IsIncognito( | 1340 bool ChromeLauncherControllerImpl::IsIncognito( |
1339 const content::WebContents* web_contents) const { | 1341 const content::WebContents* web_contents) const { |
1340 const Profile* profile = | 1342 const Profile* profile = |
1341 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1343 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
1342 return profile->IsOffTheRecord() && !profile->IsGuestSession() && | 1344 return profile->IsOffTheRecord() && !profile->IsGuestSession() && |
1343 !profile->IsSystemProfile(); | 1345 !profile->IsSystemProfile(); |
1344 } | 1346 } |
1345 | 1347 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 LauncherItemController* controller = GetLauncherItemController(item.id); | 1499 LauncherItemController* controller = GetLauncherItemController(item.id); |
1498 if (!controller || controller->image_set_by_controller()) | 1500 if (!controller || controller->image_set_by_controller()) |
1499 continue; | 1501 continue; |
1500 item.image = image; | 1502 item.image = image; |
1501 if (arc_deferred_launcher_) | 1503 if (arc_deferred_launcher_) |
1502 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); | 1504 arc_deferred_launcher_->MaybeApplySpinningEffect(id, &item.image); |
1503 model_->Set(index, item); | 1505 model_->Set(index, item); |
1504 // It's possible we're waiting on more than one item, so don't break. | 1506 // It's possible we're waiting on more than one item, so don't break. |
1505 } | 1507 } |
1506 } | 1508 } |
OLD | NEW |