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

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

Issue 1507193002: Fix several crashes for ARC app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
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/app_list/model_pref_updater.h" 5 #include "chrome/browser/ui/app_list/model_pref_updater.h"
6 6
7 #include "chrome/browser/ui/app_list/app_list_prefs.h" 7 #include "chrome/browser/ui/app_list/app_list_prefs.h"
8 #include "chrome/browser/ui/app_list/extension_app_item.h" 8 #include "chrome/browser/ui/app_list/extension_app_item.h"
9 #include "ui/app_list/app_list_folder_item.h" 9 #include "ui/app_list/app_list_folder_item.h"
10 #include "ui/app_list/app_list_item.h" 10 #include "ui/app_list/app_list_item.h"
11 #include "ui/app_list/app_list_model.h" 11 #include "ui/app_list/app_list_model.h"
12 12
13 #if defined(OS_CHROMEOS)
14 #include "chrome/browser/ui/app_list/arc/arc_app_item.h"
15 #endif
16
13 namespace app_list { 17 namespace app_list {
14 18
15 ModelPrefUpdater::ModelPrefUpdater(AppListPrefs* app_list_prefs, 19 ModelPrefUpdater::ModelPrefUpdater(AppListPrefs* app_list_prefs,
16 AppListModel* model) 20 AppListModel* model)
17 : app_list_prefs_(app_list_prefs), model_(model) { 21 : app_list_prefs_(app_list_prefs), model_(model) {
18 model_->AddObserver(this); 22 model_->AddObserver(this);
19 } 23 }
20 24
21 ModelPrefUpdater::~ModelPrefUpdater() { 25 ModelPrefUpdater::~ModelPrefUpdater() {
22 model_->RemoveObserver(this); 26 model_->RemoveObserver(this);
(...skipping 11 matching lines...) Expand all
34 UpdatePrefsFromAppListItem(item); 38 UpdatePrefsFromAppListItem(item);
35 } 39 }
36 40
37 void ModelPrefUpdater::UpdatePrefsFromAppListItem(AppListItem* item) { 41 void ModelPrefUpdater::UpdatePrefsFromAppListItem(AppListItem* item) {
38 // Write synced data to local pref. 42 // Write synced data to local pref.
39 AppListPrefs::AppListInfo info; 43 AppListPrefs::AppListInfo info;
40 if (item->GetItemType() == AppListFolderItem::kItemType) 44 if (item->GetItemType() == AppListFolderItem::kItemType)
41 info.item_type = AppListPrefs::AppListInfo::FOLDER_ITEM; 45 info.item_type = AppListPrefs::AppListInfo::FOLDER_ITEM;
42 else if (item->GetItemType() == ExtensionAppItem::kItemType) 46 else if (item->GetItemType() == ExtensionAppItem::kItemType)
43 info.item_type = AppListPrefs::AppListInfo::APP_ITEM; 47 info.item_type = AppListPrefs::AppListInfo::APP_ITEM;
48 #if defined(OS_CHROMEOS)
49 else if (item->GetItemType() == ArcAppItem::kItemType)
khmel 2015/12/08 05:42:51 'grep -r "ExtensionAppItem::kItemType" --include=*
50 info.item_type = AppListPrefs::AppListInfo::APP_ITEM;
51 #endif
44 else 52 else
45 NOTREACHED(); 53 NOTREACHED();
46 54
47 info.parent_id = item->folder_id(); 55 info.parent_id = item->folder_id();
48 info.position = item->position(); 56 info.position = item->position();
49 info.name = item->name(); 57 info.name = item->name();
50 58
51 app_list_prefs_->SetAppListInfo(item->id(), info); 59 app_list_prefs_->SetAppListInfo(item->id(), info);
52 } 60 }
53 61
54 } // namespace app_list 62 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698