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

Unified Diff: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm

Issue 10885024: Integrate Chrome To Mobile with Action Box UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address cocoa comments. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
index ae823a96b2e42a973397236d5126125fadfe0a78..8ca8c3218983214feb7f2d90f5f65d21dfa775b3 100644
--- a/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/chrome_to_mobile_bubble_controller.mm
@@ -15,6 +15,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "grit/generated_resources.h"
+#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/text/bytes_formatting.h"
@@ -88,6 +89,14 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) {
// Instruct the service to delete the snapshot file.
service_->DeleteSnapshot(snapshotPath_);
+ BrowserWindowController* controller = [BrowserWindowController
+ browserWindowControllerForWindow:self.parentWindow];
+ if (controller != nil) {
sail 2012/08/29 23:15:03 you don't need this check, message calls to nil ar
msw 2012/08/29 23:26:19 Done.
+ // Restore the Action Box icon when the bubble closes.
+ [controller locationBarBridge]->SetActionBoxIcon(IDR_ACTION_BOX_BUTTON);
+ [controller chromeToMobileBubbleWindowWillClose];
+ }
+
// We caught a close so we don't need to observe further notifications.
bridge_.reset(NULL);
[progressAnimation_ stopAnimation];
@@ -141,29 +150,25 @@ void ChromeToMobileBubbleNotificationBridge::OnSendComplete(bool success) {
[window setFrame:windowFrame display:YES animate:NO];
}
- // Get the anchor point for the bubble in screen coordinates.
BrowserWindowController* controller = [BrowserWindowController
browserWindowControllerForWindow:self.parentWindow];
if (controller != nil) {
+ // Get the anchor point for the bubble in screen coordinates.
LocationBarViewMac* locationBar = [controller locationBarBridge];
- NSPoint bubblePoint;
- if (extensions::switch_utils::IsExtensionsInActionBoxEnabled()) {
- bubblePoint = locationBar->GetActionBoxAnchorPoint();
- bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
- // Without an arrow, the anchor point of a bubble is the top left corner,
- // but GetActionBoxAnchorPoint returns the top right corner.
- bubblePoint.x -= self.bubble.frame.size.width;
- [self.bubble setArrowLocation:info_bubble::kNoArrow];
- [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners];
- [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
- [window setContentSize:self.bubble.frame.size];
- [window setContentView:self.bubble];
- } else {
- bubblePoint = locationBar->GetChromeToMobileBubblePoint();
- bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
- [self.bubble setArrowLocation:info_bubble::kTopRight];
- }
+ NSPoint bubblePoint = locationBar->GetActionBoxAnchorPoint();
+ bubblePoint = [self.parentWindow convertBaseToScreen:bubblePoint];
+ // Without an arrow, the anchor point of a bubble is the top left corner,
+ // but GetActionBoxAnchorPoint returns the top right corner.
+ bubblePoint.x -= self.bubble.frame.size.width;
+ [self.bubble setArrowLocation:info_bubble::kNoArrow];
+ [self.bubble setCornerFlags:info_bubble::kRoundedBottomCorners];
+ [self.bubble setAlignment:info_bubble::kAlignEdgeToAnchorEdge];
+ [window setContentSize:self.bubble.frame.size];
+ [window setContentView:self.bubble];
[self setAnchorPoint:bubblePoint];
+
+ // Show the lit Chrome To Mobile icon while the bubble is open.
+ locationBar->SetActionBoxIcon(IDR_MOBILE_LIT);
}
// Initialize the checkbox to send an offline copy.

Powered by Google App Engine
This is Rietveld 408576698