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

Side by Side Diff: chrome/browser/extensions/extension_shelf_model.cc

Issue 208020: Change the view mode when switching between moles and toolstrips, and (Closed)
Patch Set: build system workarounds Created 11 years, 3 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/extensions/extension_shelf_model.h" 5 #include "chrome/browser/extensions/extension_shelf_model.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/profile.h" 9 #include "chrome/browser/profile.h"
10 #include "chrome/browser/extensions/extension_host.h" 10 #include "chrome/browser/extensions/extension_host.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (toolstrip == end()) 131 if (toolstrip == end())
132 return; 132 return;
133 toolstrip->height = height; 133 toolstrip->height = height;
134 toolstrip->url = url; 134 toolstrip->url = url;
135 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_, 135 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_,
136 ToolstripChanged(toolstrip)); 136 ToolstripChanged(toolstrip));
137 int routing_id = toolstrip->host->render_view_host()->routing_id(); 137 int routing_id = toolstrip->host->render_view_host()->routing_id();
138 ToolstripEventRouter::OnToolstripExpanded(browser_->profile(), 138 ToolstripEventRouter::OnToolstripExpanded(browser_->profile(),
139 routing_id, 139 routing_id,
140 url, height); 140 url, height);
141 toolstrip->host->SetRenderViewType(ViewType::EXTENSION_MOLE);
141 } 142 }
142 143
143 void ExtensionShelfModel::CollapseToolstrip(iterator toolstrip, 144 void ExtensionShelfModel::CollapseToolstrip(iterator toolstrip,
144 const GURL& url) { 145 const GURL& url) {
145 if (toolstrip == end()) 146 if (toolstrip == end())
146 return; 147 return;
147 toolstrip->height = 0; 148 toolstrip->height = 0;
148 toolstrip->url = url; 149 toolstrip->url = url;
149 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_, 150 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_,
150 ToolstripChanged(toolstrip)); 151 ToolstripChanged(toolstrip));
151 int routing_id = toolstrip->host->render_view_host()->routing_id(); 152 int routing_id = toolstrip->host->render_view_host()->routing_id();
152 ToolstripEventRouter::OnToolstripCollapsed(browser_->profile(), 153 ToolstripEventRouter::OnToolstripCollapsed(browser_->profile(),
153 routing_id, 154 routing_id,
154 url); 155 url);
156 toolstrip->host->SetRenderViewType(ViewType::EXTENSION_TOOLSTRIP);
155 } 157 }
156 158
157 void ExtensionShelfModel::Observe(NotificationType type, 159 void ExtensionShelfModel::Observe(NotificationType type,
158 const NotificationSource& source, 160 const NotificationSource& source,
159 const NotificationDetails& details) { 161 const NotificationDetails& details) {
160 switch (type.value) { 162 switch (type.value) {
161 case NotificationType::EXTENSION_LOADED: 163 case NotificationType::EXTENSION_LOADED:
162 if (ready_) 164 if (ready_)
163 AddExtension(Details<Extension>(details).ptr()); 165 AddExtension(Details<Extension>(details).ptr());
164 break; 166 break;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Any toolstrips remaining in |copy| were somehow missing from the prefs, 274 // Any toolstrips remaining in |copy| were somehow missing from the prefs,
273 // so just append them to the end. 275 // so just append them to the end.
274 for (iterator toolstrip = copy.begin(); 276 for (iterator toolstrip = copy.begin();
275 toolstrip != copy.end(); ++toolstrip) { 277 toolstrip != copy.end(); ++toolstrip) {
276 toolstrips_.push_back(*toolstrip); 278 toolstrips_.push_back(*toolstrip);
277 } 279 }
278 280
279 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_, 281 FOR_EACH_OBSERVER(ExtensionShelfModelObserver, observers_,
280 ShelfModelReloaded()); 282 ShelfModelReloaded());
281 } 283 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_host.cc ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698