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

Side by Side Diff: chrome/browser/ui/views/extensions/bookmark_app_bubble_view.cc

Issue 869483003: Reverse logic of window / tab control in bookmark app creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Created 5 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/extensions/bookmark_app_bubble_view.h" 5 #include "chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/extensions/app_icon_loader_impl.h" 10 #include "chrome/browser/extensions/app_icon_loader_impl.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 views::View* anchor_view, 82 views::View* anchor_view,
83 Profile* profile, 83 Profile* profile,
84 const WebApplicationInfo& web_app_info, 84 const WebApplicationInfo& web_app_info,
85 const std::string& extension_id) 85 const std::string& extension_id)
86 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 86 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
87 profile_(profile), 87 profile_(profile),
88 web_app_info_(web_app_info), 88 web_app_info_(web_app_info),
89 extension_id_(extension_id), 89 extension_id_(extension_id),
90 add_button_(NULL), 90 add_button_(NULL),
91 cancel_button_(NULL), 91 cancel_button_(NULL),
92 open_as_tab_checkbox_(NULL), 92 open_as_window_checkbox_(NULL),
93 title_tf_(NULL), 93 title_tf_(NULL),
94 remove_app_(true), 94 remove_app_(true),
95 app_icon_loader_(new extensions::AppIconLoaderImpl(profile, 95 app_icon_loader_(new extensions::AppIconLoaderImpl(profile,
96 kIconSize, 96 kIconSize,
97 this)) { 97 this)) {
98 const SkColor background_color = GetNativeTheme()->GetSystemColor( 98 const SkColor background_color = GetNativeTheme()->GetSystemColor(
99 ui::NativeTheme::kColorId_DialogBackground); 99 ui::NativeTheme::kColorId_DialogBackground);
100 set_arrow(views::BubbleBorder::TOP_CENTER); 100 set_arrow(views::BubbleBorder::TOP_CENTER);
101 set_color(background_color); 101 set_color(background_color);
102 set_background(views::Background::CreateSolidBackground(background_color)); 102 set_background(views::Background::CreateSolidBackground(background_color));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 layout->AddView(icon_image_view_); 181 layout->AddView(icon_image_view_);
182 app_icon_loader_->FetchImage(extension_id_); 182 app_icon_loader_->FetchImage(extension_id_);
183 183
184 title_tf_ = new views::Textfield(); 184 title_tf_ = new views::Textfield();
185 title_tf_->SetText(extension ? base::UTF8ToUTF16(extension->name()) 185 title_tf_->SetText(extension ? base::UTF8ToUTF16(extension->name())
186 : web_app_info_.title); 186 : web_app_info_.title);
187 layout->AddView(title_tf_); 187 layout->AddView(title_tf_);
188 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 188 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
189 189
190 layout->StartRow(0, CONTENT_COLUMN_SET_ID); 190 layout->StartRow(0, CONTENT_COLUMN_SET_ID);
191 open_as_tab_checkbox_ = new views::Checkbox( 191 open_as_window_checkbox_ = new views::Checkbox(
192 l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_TAB)); 192 l10n_util::GetStringUTF16(IDS_BOOKMARK_APP_BUBBLE_OPEN_AS_WINDOW));
193 open_as_tab_checkbox_->SetChecked( 193 open_as_window_checkbox_->SetChecked(
194 profile_->GetPrefs()->GetInteger( 194 profile_->GetPrefs()->GetInteger(
195 extensions::pref_names::kBookmarkAppCreationLaunchType) == 195 extensions::pref_names::kBookmarkAppCreationLaunchType) ==
196 extensions::LAUNCH_TYPE_REGULAR); 196 extensions::LAUNCH_TYPE_WINDOW);
197 layout->AddView(open_as_tab_checkbox_); 197 layout->AddView(open_as_window_checkbox_);
198 layout->AddView(add_button_); 198 layout->AddView(add_button_);
199 layout->AddView(cancel_button_); 199 layout->AddView(cancel_button_);
200 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); 200 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
201 201
202 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); 202 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE));
203 } 203 }
204 204
205 views::View* BookmarkAppBubbleView::GetInitiallyFocusedView() { 205 views::View* BookmarkAppBubbleView::GetInitiallyFocusedView() {
206 return title_tf_; 206 return title_tf_;
207 } 207 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Unset |remove_app_| so we don't delete the bookmark after the window 254 // Unset |remove_app_| so we don't delete the bookmark after the window
255 // closes. 255 // closes.
256 if (sender == add_button_) 256 if (sender == add_button_)
257 remove_app_ = false; 257 remove_app_ = false;
258 258
259 GetWidget()->Close(); 259 GetWidget()->Close();
260 } 260 }
261 261
262 void BookmarkAppBubbleView::ApplyEdits() { 262 void BookmarkAppBubbleView::ApplyEdits() {
263 // Set the launch type based on the checkbox. 263 // Set the launch type based on the checkbox.
264 extensions::LaunchType launch_type = open_as_tab_checkbox_->checked() 264 extensions::LaunchType launch_type = open_as_window_checkbox_->checked()
265 ? extensions::LAUNCH_TYPE_REGULAR 265 ? extensions::LAUNCH_TYPE_WINDOW
266 : extensions::LAUNCH_TYPE_WINDOW; 266 : extensions::LAUNCH_TYPE_REGULAR;
267 profile_->GetPrefs()->SetInteger( 267 profile_->GetPrefs()->SetInteger(
268 extensions::pref_names::kBookmarkAppCreationLaunchType, launch_type); 268 extensions::pref_names::kBookmarkAppCreationLaunchType, launch_type);
269 extensions::SetLaunchType(GetExtensionService(profile_), 269 extensions::SetLaunchType(GetExtensionService(profile_),
270 extension_id_, 270 extension_id_,
271 launch_type); 271 launch_type);
272 272
273 const extensions::Extension* extension = 273 const extensions::Extension* extension =
274 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById( 274 extensions::ExtensionRegistry::Get(profile_)->GetExtensionById(
275 extension_id_, extensions::ExtensionRegistry::EVERYTHING); 275 extension_id_, extensions::ExtensionRegistry::EVERYTHING);
276 276
(...skipping 30 matching lines...) Expand all
307 GURL(chrome::kChromeUIAppsURL), 307 GURL(chrome::kChromeUIAppsURL),
308 ui::PAGE_TRANSITION_LINK); 308 ui::PAGE_TRANSITION_LINK);
309 params.disposition = SINGLETON_TAB; 309 params.disposition = SINGLETON_TAB;
310 chrome::Navigate(&params); 310 chrome::Navigate(&params);
311 311
312 content::NotificationService::current()->Notify( 312 content::NotificationService::current()->Notify(
313 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP, 313 chrome::NOTIFICATION_APP_INSTALLED_TO_NTP,
314 content::Source<content::WebContents>(params.target_contents), 314 content::Source<content::WebContents>(params.target_contents),
315 content::Details<const std::string>(&extension_id_)); 315 content::Details<const std::string>(&extension_id_));
316 } 316 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/bookmark_app_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698